본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 7240번 Rogutės

by 현장 2023. 10. 17.

-Code

n, s = map(int, input().split())
res = 0
for _ in range(n):
    speed = int(input())
    if res > s:
        res -= 1
    res += speed

print(res)