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

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. ))))