[백준 1205][Python] 등수 구하기

봉글렛·2023년 2월 7일

백준

목록 보기
48/55

문제 링크 https://www.acmicpc.net/problem/1205

예외들을 잘 처리해 주어야 한다.

풀이

n, new, p = map(int, input().split())

if n == 0:
    print(1)
else:
    ranking = [*map(int, input().split())]
    if n == p and ranking[-1] >= new:
        print(-1)
    else:
        result = n + 1
        for i in range(n):
            if ranking[i] <= new:
                result = i + 1
                break
        print(result)
profile
어쩌다 개발자 (할 수 있을 때까지!!!!)

0개의 댓글