Why WA? I can't understand!

Posted by

Dr.Dro 14 Jun 2007 20:53

Here is my code:

program Project2;

{$APPTYPE CONSOLE}

uses

SysUtils;

var n,max,i,sum,a:integer;

begin

max:=0;

sum:=0;

readln(n);

for i:=1 to n do

begin

readln(a);

sum:=sum+a;

if sum>max then

max:=sum;

end;

writeln(max);

end.

I've tested it. It is allright. But i get WA!!!

Why?