https://www.acmicpc.net/problem/1205
1205번: 등수 구하기
첫째 줄에 N, 태수의 새로운 점수, 그리고 P가 주어진다. P는 10보다 크거나 같고, 50보다 작거나 같은 정수, N은 0보다 크거나 같고, P보다 작거나 같은 정수이다. 그리고 모든 점수는 2,000,000,000보
www.acmicpc.net
📕 나의 풀이 📕
'''
Method : Typing Studying
title : position
condition
N, score, P
which position chulsu will have ?
'''

🧑🏻💻 나의 코드 🧑🏻💻
N, new_score, P = map(int, input().split())
if N == 0:
print(1)
else:
cur_score = list(map(int, input().split()))
if N == P and cur_score[-1] >= new_score:
print(-1)
else:
result = N + 1
for i in range(N):
if cur_score[i] <= new_score:
result = i + 1
break
print(result)
'Programming > Algorithm' 카테고리의 다른 글
[백준] #1009 분산처리 python (2) | 2023.12.21 |
---|---|
[백준] #20125 쿠키의 신체 측정 python (0) | 2023.09.26 |
[백준] #25757 임스와 함께하는 미니게임 python (0) | 2023.09.25 |
[백준] #4659 비밀번호 발음하기 python (0) | 2023.09.24 |
[백준] #10878 스택 python (0) | 2023.09.23 |