[구현/수학] 백준 17094 Serious Problem - 파이썬(Python)


[구현/수학] 백준 17094 Serious Problem - 파이썬(Python)

[ Contents ] 1. 문제 (링크 참조) 17094번: Serious Problem 2의 등장횟수가 더 많다면 2를 출력하고, e의 등장횟수가 더 많다면 e를 출력한다. 등장횟수가 같다면 "yee"를 출력한다. (큰 따옴표 제외) www.acmicpc.net 2. 문제 풀이 e와 2를 구분하는 문제입니다. 3. 코드 import sys input = sys.stdin.readline # 입력 s = int(input().rstrip()) count_e = input().count('e') print(['2', 'e', 'yee'][(count_e > s - count_e) + ((s - count_e) == count_e) * 2]) 파이썬에는 문자열 내장함수에 count가 있습니다. 이를 활용하..


원문링크 : [구현/수학] 백준 17094 Serious Problem - 파이썬(Python)