[백준/파이썬] 17530번 풀이

업데이트:



문제 정보


풀이

문제

The Kingdom of Matchings is governed by a generous commander. The commander’s fame and great qualities are known to all, including neighboring kingdoms. One of his most famous qualities is his good humor, which is nourished daily by a court buffoon, elected annually at the Great Comedy Contest (GCC) of the kingdom. The court buffoon helps to relieve all the tension of the various political meetings the work demands, rejoicing not only the commander but the whole kingdom.

Young Carlos is a great comedian whose dream is to become next season’s buffoon. …

입력 요약
The first line of input contains an integer N, (2 ≤ N ≤ 104). The next N lines will contain N positive integers v1, . . . , vN , one on each line, corresponding to the number of votes each candidate received, in order of registration. …

출력 요약
Your program must output a single line containing the character ‘S’ if young Carlos is elected as buffoon, or the character ‘N’ otherwise.

코드

l=[int(input())for _ in range(int(input()))]
print('S'if l[0]==max(l)else'N')

설명

핵심은 구현 관점에서 The Kingdom of Matchings is governed by a generous commander. The commander’s fame and great qualities are known to all, including neighboring kingdom …를 만족하도록 로직을 구성하는 것입니다.

코드는 입력을 파싱한 뒤 조건 분기와 계산을 순서대로 수행하고, 문제에서 요구한 형식으로 결과를 출력합니다.

경계값과 예외 케이스도 함께 고려해 오답이 나기 쉬운 상황을 방지합니다.



댓글남기기