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 added just one sentence then got "Output limit Exceeded"!What's that??!!
Posted by Acid Pea 26 Nov 2002 19:40
Look the sentence with "!!!":
program p1048new;
var last,last2,n,p,q,s,i,j,k:longint;a:string;
begin
     readln(n);last2:=-1;j:=0;
     for i:=1 to n do begin
         readln(p,q);last:=p+q;
         if (last<9)and(last2<>-1) then begin
            if s=0 then begin
            write(last2);last2:=last;end;
            if s<>0 then begin
               write(last2);
        !!!!!!!! for j:=1 to s do write('9');!!!!!!!!
               s:=0;last2:=last;end;end;
         if last=9 then inc(s);
         if (last>9)and(last2<>-1) then begin
            if s=0 then begin
               write(last2+1);last2:=last mod 10;end;
            if s<>0 then begin
               if last2=9 then dec(s);
               write(last2+1);
              for j:=1 to s do write('0');
               s:=0;last2:=last mod 10;
               end;
               end;
         if last2=-1 then last2:=last;
     end;
     last:=last mod 10;
     if s=0 then write(last);
     if s<>0 then for i:=1 to s do write('9');
     readln;
end.
I got AC!
Posted by Ural_Yin Tong 21 Dec 2002 17:37