|
|
back to boardWA(1).why?And Accept? WA(1) var a:array[1..10000] of integer; c:array[0..9999] of integer; n,i,j:integer; s:integer; b:boolean; begin fillchar(c,sizeof(c),255); s:=0; readln(n); b:=true; i:=0; while b do begin inc(i); read(a[i]); s:=(s+a[i])mod n; if s=0 then begin b:=false; writeln(i); for j:=1 to i do writeln(a[i]); end else if c[s]=-1 then c[s]:=i else begin b:=false; writeln(i-c[s]); for j:=c[s]+1 to i do writeln(a[j]); end; end; end. --------------------------------------- Accept: var n,i,l,sum:integer; b:boolean; c,v:array[0..9999]of integer; begin fillchar(v,sizeof(v),255); read(n); b:=true; i:=0; while b do begin read(c[i]); sum:=(c[i]+sum)mod n; if sum=0 then begin b:=false; writeln(i+1); for l:=0 to i do writeln(c[l]); end else if v[sum]=-1 then v[sum]:=i else begin b:=false; writeln(i-v[sum]); for l:=v[sum]+1 to i do writeln(c[l]); end; inc(i); end; end. ---------------------------- I don't understand?????????? |
|
|