|  | 
|  | 
| вернуться в форум | Why WA#6? This is my solution! Послано wayne  30 апр 2009 11:36program u1126;
 var
 a:array[1..25000] of longint;
 n,max,i,j:longint;
 
 begin
 readln(n); max:=-maxlongint;
 for i:=1 to n do
 begin
 readln(a[i]);
 if (a[i]=-1) and (i=1)
 then halt;
 if (a[i]=-1)
 then begin writeln(max); halt; end;
 if a[i]>max
 then max:=a[i];
 end;
 writeln(max);
 if max=a[1]
 then max:=a[2];
 i:=n+1;
 while true do
 begin
 readln(a[i]);
 if a[i]=-1
 then break;
 if a[i]>max
 then max:=a[i];
 writeln(max);
 if max=a[i-n+1]
 then max:=a[i-n+2];
 inc(i);
 end;
 end.
 
 
 
 
 
 I really can't find out where it wrongs!!
 | 
 | 
|