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

Test 6. What's wrong? pascal
Posted by Nick 8 Mar 2016 20:23
var minutes, carsAtMin, stay, i: byte;
    countOfCars: array[0..100] of integer;
BEGIN
readln(carsAtMin, minutes);
stay := 0;
for i:=1 to minutes do
    readln(countOfCars[i]);
for i:=1 to minutes do
    begin
    countOfCars[i] := countOfCars[i] + stay;
    stay := 0;
    if (countOfCars[i] - carsAtMin > 0) then stay := countOfCars[i] - carsAtmin;
    end;
if (stay > 0) then write(stay)
else write('0');
END.