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

嘻嘻

Posted by 1606880712 at 2015-08-02 19:00:26 on Problem 2356
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:
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