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 1048. Superlong Sums

Help!Why I always get WA?
Posted by Bighead 17 Apr 2002 14:30
I think my program is correct,but it always gets WA,why?
Here is my program:

program U1048;
const
  digits=100000000;
var
  n1,n2:array[0..200000] of longint;
  i,j,n,a,b:longint;
  s:string;
begin
  readln(n);
  n1[0]:=0;
  for j:=n div 8*8+1 to n do begin
      readln(a,b);
      n1[1]:=n1[1]*10+a;
      n2[1]:=n2[1]*10+b;
  end;
  inc(n1[1],n2[1]);
  for i:=1 to n div 8 do begin
    for j:=1 to 8 do begin
      readln(a,b);
      n1[i+1]:=n1[i+1]*10+a;
      n2[i+1]:=n2[i+1]*10+b;
    end;
    inc(n1[i+1],n2[i+1]);
  end;
  for i:=n div 8+1 downto 1 do
    if n1[i]>=digits then begin
      dec(n1[i],digits);
      inc(n1[i-1]);
    end;
  j:=0;
  while (n1[j]=0)and(j<200000) do inc(j);
  if n1[j]=0 then writeln(0)
  else begin
    write(n1[j]);
    for i:=j+1 to n div 8+1 do begin
      str(n1[i],s);
      while length(s)<8 do s:='0'+s;
      write(s);
    end;
    writeln;
  end;
end.
Re: Help!Why I always get WA?
Posted by ECUST Multistar 18 Apr 2002 13:57
Oh, my god!You uses Array?
Can you pass the Memory Limited?
Maybe you can but you needn't use it at all.:(
I'm so sorry that I can't understand you program at all.
but If you want ,I'll give you some hint.
Give up in this way.OK?
Re: Help!Why I always get WA?
Posted by sikee8 18 Apr 2002 19:33
1
0 0

your answer - 1

but why my program have WA http://acm.timus.ru/messages.asp?id=4615 ?
Re: Help!Why I always get WA?
Posted by Bighead 19 Apr 2002 06:46
> 1
> 0 0
>
> your answer - 1

But on my pc my answer is 0.Why?
Re: Help!Why I always get WA?
Posted by Bighead 19 Apr 2002 06:56
In my program, I use a longint to save 8 digits, so I can pass the
memory limit easily, but it always get WA, I really don't know why.
Re: Help!Why I always get WA?
Posted by sikee8 9 May 2002 06:55
> > 1
> > 0 0
> >
> > your answer - 1
>
> But on my pc my answer is 0.Why?

i don't know. i've use turbo pascal 7.0 ...
and, if this test correct.
2
0 0
1 1

your answer is 2 (on my pc ;) ) but your must output 02.