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

Why I got WA on test 3#??
Posted by akademi 30 Oct 2004 19:58
Program ural1048;
Var
  i,j,t,n,c,a,b:longint;
  p:boolean;
Begin
  readln(n);
  t:=0;
  p:=false;
  for i:=1 to n do
    begin
      readln(a,b);
      if a+b<9 then
        begin
          if p then write(c);
          for j:=1 to t do write(9);
          t:=0;
          c:=a+b;
          p:=true;
        end;
      if a+b=9 then inc(t);
      if a+b>9 then
        begin
          write(c+1);
          for j:=1 to t do write(0);
          t:=0;
          c:=(a+b) mod 10;
          p:=true
        end
    end;
  write(c);
  for i:=1 to t do write(9);
  writeln;
End.

Edited by author 30.10.2004 19:58
A test for you (+)
Posted by Michael Rybak (accepted@ukr.net) 30 Oct 2004 22:15
1
4 5
Re: A test for you (+)
Posted by akademi 31 Oct 2004 05:54
Thank you.