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

Bighead Help!Why I always get WA? [5] // Problem 1048. Superlong Sums 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.
ECUST Multistar Re: Help!Why I always get WA? [1] // Problem 1048. Superlong Sums 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?
Bighead Re: Help!Why I always get WA? // Problem 1048. Superlong Sums 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.
sikee8 Re: Help!Why I always get WA? [2] // Problem 1048. Superlong Sums 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 ?
Bighead Re: Help!Why I always get WA? [1] // Problem 1048. Superlong Sums 19 Apr 2002 06:46
> 1
> 0 0
>
> your answer - 1

But on my pc my answer is 0.Why?
sikee8 Re: Help!Why I always get WA? // Problem 1048. Superlong Sums 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.