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

WA#3, please helpPPPPPPPPPP!!!!
Posted by Bobur 10 Feb 2008 20:21
here is my code!!!
   var
   a : array [0..9] of char=('0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
   i, n, j, k, x, y, last : integer;

begin
   read(n);
   read(x, y);  i := 1;  last := x+y;
   if n=1 then write(last)
   else   begin
   repeat
   read(x, y);   inc(i);
   if x+y<>9 then begin write(a[last + (x+y)div 10]);  last := (x+y) mod 10;  end
   else
     begin
       j := 1;
       repeat
       read(x, y);   inc(i);  inc(j);
       until (x+y<>9) or (j=10) or (i>=n);
       if x+y<9 then
         begin
           write(a[last]);
           for k := 1 to j-1 do
           write(a[9]);
           last := x + y;
         end;
       if x+y>9 then
         begin
           write(a[last+1]);
           for k := 1 to j-1 do
           write(a[0]);
           last := x + y-10;
         end;
       if x+y=9 then
         begin
           write(a[last+1]);
           for k := 1 to j-1 do
           write(a[0]);
           last := -1;
         end;
     end;
   until i=n;
   write(a[last]);   end;
end.

what i must do, i can't ubderstand where is my wrong!!!
thaks

Edited by author 10.02.2008 20:22

Edited by author 10.02.2008 20:23