파이썬/코딩 테스트
201p <실전 문제> : 떡볶이 떡 만들기
L_SU
2022. 7. 5. 20:50
# 떡볶이 떡 만들기
N, M = map(int, input().split())
CM = list(map(int, input().split()))
result = 0
i = 0
while i < N:
if result == M:
break
else:
if i >= N:
i = 0
else:
CM[-1] -= 1
result += 1
CM.sort()
print(CM[-1])