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 1108. Heritage

Why I got WA?
Posted by qwt 9 Apr 2002 19:23
const
  ws=2000;
  mw=4;
type
  ttype=array[1..ws] of longint;
var
  x:ttype;
  i,j,k,a,b,n:longint;
procedure print;
var
  i,j,k:longint;
  s:string;
begin
  for i:=ws downto 1 do if x[i]>0 then break;
  write(x[i]);
  for j:=i-1 downto 1 do begin
    str(x[j],s);
    while length(S)<mw do s:='0'+s;
    write(s);
  end;
  writeln;
end;
procedure makenum;
var
  i,j,k,p,q:longint;
  a,b:ttype;
begin
  fillchar(a,sizeof(a),0);b:=a;a:=x;
  i:=1;
  while x[i]=9999 do begin
    x[i]:=0;
    inc(i);
  end;
  inc(x[i]);
  print;

  for i:=1 to 1000 do begin
    for j:=1 to 1000 do begin
      inc(b[i+j-1],x[i]*a[j]);
      inc(b[i+j],b[i+j-1] div 10000);
      b[i+j-1]:=b[i+j-1] mod 10000;
    end;
  end;
  x:=b;
end;



begin
  fillchar(x,sizeof(x),0);
  x[1]:=2;
  readln(n);
  writeln(2);
  if n>=1 then
  for i:=2 to n do begin
    makenum;
  end;
end.
if I input n=18 ,does this answer right?
Posted by qwt 9 Apr 2002 19:26
del

Edited by moderator 15.06.2008 16:15
who can give me the right answer if n=18
Posted by qwt 9 Apr 2002 19:51
del

Edited by moderator 15.06.2008 16:15