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 |
改了还是WA,谁帮我看看。。。code PascalIn Reply To:这么简单的程序都WA掉了。。。。。谁帮我看看。。。code Pascal Posted by:My_loves at 2005-11-13 15:23:09 program p2356; var n:integer; num:array[0..10000]of integer; sum:array[1..10000]of integer; procedure init; var i:integer; begin readln(n); for i:=1 to n do begin readln(sum[i]); num[sum[i] mod n]:=i; end; end; procedure main; var i,out:integer; begin out:=0; if (num[0]<>0) and (sum[num[0]]<>0) then inc(out); for i:=1 to n div 2 do if (num[i]<>0) and (num[n-i]<>0) and (i<>n-i)then inc(out,2); writeln(out); if (num[0]<>0) and (sum[num[0]]<>0) then writeln(sum[num[0]]); for i:=1 to n div 2 do if (num[i]<>0) and (num[n-i]<>0) and (i<>n-i) then begin writeln(sum[num[i]]); writeln(sum[num[n-i]]); end; end; begin fillchar(num,sizeof(num),0); init; main; end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator