쉬운 문제..
N = int(input())
if N == 1:
print(0)
else:
votes = []
for i in range(N):
votes.append(int(input()))
pick = votes.pop(0)
votes = sorted(votes, reverse=True)
ans = 0
while True:
if pick > max(votes):
break
votes[0] -= 1
pick += 1
votes = sorted(votes, reverse=True)
ans += 1
print(ans)
'Algorithm > Implementaion' 카테고리의 다른 글
[백준] 11659번 구간 합 구하기 4 (0) | 2020.12.04 |
---|---|
[백준] 1357 뒤집힌 덧셈 (0) | 2020.11.30 |
[백준] 11286번 절대값 힙 (0) | 2020.11.26 |
[백준] 1913번 달팽이 (0) | 2020.11.26 |
[백준] 1032번 명령 프롬프트 (0) | 2020.11.25 |
댓글