ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1032. Find a Multiple

Why have I got WA????????
Posted by Cosine 5 Aug 2003 09:40
var n,x,y,i:integer;
    s,w:array [0..10000] of integer;

procedure init;
  var i,k:integer;
begin
  readln(n);
  for i:=0 to 10000 do w[i]:=-1;
  s[0]:=0; w[0]:=0;

  for i:=1 to n do begin
    read(k);
    s[i]:=s[i-1]+k;
    if w[s[i] mod n]=-1 then w[s[i] mod n]:=i
      else begin
        x:=w[s[i] mod n];
        y:=i;
      end;
  end;

end;

begin

  x:=0; y:=0;
  init;

  if not((x=0) and (y=0)) then
  begin
    writeln(y-x);
    for i:=x+1 to y do writeln(s[i]-s[i-1]);
  end
  else writeln(0);

end.