티스토리 뷰
https://www.acmicpc.net/problem/1205
단순 구현 문제.
if __name__ == '__main__':
rank_registering, score, rank_count = map(int, input().split())
rank_score_list = []
if rank_registering == 0:
print(1)
exit()
rank_score_list = list(map(int, input().split()))
# 현재 랭킹등록 수와 랭킹 등록되어야 하는 수가 같고
# 비교할 score가 마지막 랭크 리스트(최소값)보다 작으면 랭킹등록이 안되니 -1
if rank_registering == rank_count and rank_score_list[-1] >= score:
print(-1)
exit()
# answer을 랭킹등록수 + 1을 해놓고 반복문을 돌린다
# (만약 break문에 들어가지 않을 때 가장 작은 값이므로)
# 리스트 비교 값과 score 비교 시 score가 리스트 비교 값 이상일 때 현재 i(인덱스) + 1
else:
answer = rank_registering + 1
for i in range(rank_registering):
if rank_score_list[i] <= score:
answer = i + 1
break
print(answer)
'알고리즘 > 문제' 카테고리의 다른 글
실버III. 백준1904 01타일 (0) | 2022.04.09 |
---|---|
실버III. 백준 11727 2 x N 타일링 2 (0) | 2022.04.08 |
실버III. 백준 1244 스위치 켜고 끄기 (0) | 2022.04.06 |
실버V. 백준 1059 좋은구간 (0) | 2022.04.04 |
브론즈II. 백준10093 숫자 (0) | 2022.03.30 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- ㄴ
- https://subicura.com/2017/01/19/docker-guide-for-beginners-1.html
- https://react.vlpt.us/basic/11-render-array.html
- Co
- https://react.vlpt.us/
- https://velog.io/@juno7803/React%EA%B0%80-%ED%83%9C%EC%96%B4%EB%82%9C-%EB%B0%B0%EA%B2%BD
- https://wikidocs.net/68
- https://jwprogramming.tistory.com/52
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함