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

wa6 pascal
Posted by maksimla 23 Sep 2012 01:05
var k,n,i,sum,s:integer;
begin
readln(k,n);
sum:=0;
for i:=1 to n do
begin
readln(s);
sum:=sum+s-k;
if sum<0 then sum:=0;
end;
//sum:=sum+s-k;
//if sum<0 then sum:=0;
writeln(sum);
readln;
end.

whot wrong?
Re: wa6 pascal
Posted by Salimov Albert 6 Nov 2012 00:24


Edited by author 06.11.2012 01:22
Re: wa6 pascal
Posted by alexProgrammer 6 Nov 2012 10:27
maksimla wrote 23 September 2012 01:05
var k,n,i,sum,s:integer;
begin
readln(k,n);
sum:=0;
for i:=1 to n do
begin
read(s);  // here must be read. not readln;
sum:=sum+s-k;
if sum<0 then sum:=0;
end;
//sum:=sum+s-k;
//if sum<0 then sum:=0;
writeln(sum);
end.

whot wrong?