Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这么简单的程序都WA掉了。。。。。谁帮我看看。。。code Pascal

Posted by My_loves at 2005-11-13 15:23:09 on Problem 2356
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 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 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(num[i]);
      writeln(num[n-i]);
     end;
  end;

 begin
  fillchar(num,sizeof(num),0);
  init;
  main;
 end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator