https://www.acmicpc.net/problem/2790
코드
import sys
input = sys.stdin.readline
n = int(input())
scores = [int(input()) for _ in range(n)]
scores.sort(reverse=True)
cutline = scores[0]+1
answer = 1
for i in range(1, n):
possible_max_score = scores[i]+n
if cutline > possible_max_score:
break
cutline = max(cutline, scores[i]+i+1)
answer += 1
print(answer)
'문제풀이 > Greedy' 카테고리의 다른 글
[Python/파이썬] 백준 11000번 강의실 배정 (0) | 2025.04.24 |
---|---|
[Python/파이썬] 백준 3216번 다운로드 (0) | 2025.04.23 |
[Python/파이썬] 백준 30404번 오리와 박수치는 춘배 (0) | 2025.04.04 |
[Python/파이썬] 백준 28228번 Parking Party (0) | 2025.03.30 |
[Python/파이썬] 백준 1036번 36진수 (0) | 2025.03.25 |