PersonalCorpus 版 (精华区)
158207 05:43:33 9 Mar 2002
Bozhang,HIT,P.R.China 1032 Pascal Accepted 0.03 sec 110K
var
a,sum:array[0..10000] of word;
from:array[0..9999] of word;
i,j,n:integer;
begin
fillchar(from,sizeof(from),0);
readln(n);
sum[0]:=0;
for i:=1 to n do begin
readln(a[i]);
sum[i]:=(a[i]+sum[i-1]) mod n;
if sum[i]=0 then begin
writeln(i);
for j:=1 to i do writeln(a[j]);
break;
end;
if from[sum[i]]=0 then from[sum[i]]:=i else begin
writeln(i-from[sum[i]]);
for j:=from[sum[i]]+1 to i do writeln(a[j]);
break;
end;
end;
end.
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.220毫秒