ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1787. Turn for MEGA

Python3 answer
Posted by Evgeniy 25 Mar 2018 21:56
k, n = [int(x) for x in input().split()]
a = list(map(int, input().split()))
m = 0

for i in a:
    m += i
    if (m - k >= 0):
        m -= k
    else:
        m = 0
print(m)
Re: Python3 answer
Posted by ok_SYS 19 Dec 2021 18:21
explain please. for whar we need n then?
Re: Python3 answer
Posted by Vladimir 23 Apr 2022 15:50
try this example:
4 3
1 5 6
You cannot pass the sixth test. In the first minute there are 0 cars left. In the second minute there was 1 car left. At the third minute there were 2+1 cars left.
Read the conditions of the task more carefully. ))))