| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
嘻嘻In Reply To:这么简单的程序都WA掉了。。。。。谁帮我看看。。。code Pascal Posted by:My_loves at 2005-11-13 15:23:09 const maxn=10005;
var
n,m,l,r,i:longint;
sum,a,h:array [0..maxn] of longint;
begin
readln(n);
fillchar(h,sizeof(h),255);
h[0]:=0;
for i:=1 to n do
begin
read(a[i]);
sum[i]:=(sum[i-1]+a[i]) mod n;
if h[sum[i]]=-1 then h[sum[i]]:=i
else
begin
l:=h[sum[i]];
r:=i;
end;
end;
writeln(r-l);
for i:=l+1 to r do writeln(a[i]);
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator