|
|
вернуться в форумWhy have I got WA???????? Послано Cosine 5 авг 2003 09:40 var n,x,y,i:integer; s,w:array [0..10000] of integer; procedure init; var i,k:integer; begin readln(n); for i:=0 to 10000 do w[i]:=-1; s[0]:=0; w[0]:=0; for i:=1 to n do begin read(k); s[i]:=s[i-1]+k; if w[s[i] mod n]=-1 then w[s[i] mod n]:=i else begin x:=w[s[i] mod n]; y:=i; end; end; end; begin x:=0; y:=0; init; if not((x=0) and (y=0)) then begin writeln(y-x); for i:=x+1 to y do writeln(s[i]-s[i-1]); end else writeln(0); end. |
|
|