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

28K only
Posted by Sergeyev Alexander 7 May 2003 14:21
var cyc2,tm,s1,s2,s,n,k,cyc1:longint;
begin
  read(n);
  read(s1,s2);
  tm:=s1+s2;
  k:=0;
  if tm=9 then inc(k);
  for cyc1:=1 to n-1 do
    begin
      read(s1,s2);
      s:=s1+s2;
      if k=0 then
        begin
          if s<9 then begin write(tm);tm:=s; end;
          if s=9 then inc(k);
          if s>9 then begin write(tm+1);tm:=s-10; end;
        end
      else
         begin
          if s<9 then begin write(tm);for cyc2:= 1 to k do write
(9);tm:=s;k:=0; end;
          if s=9 then inc(k);
          if s>9 then begin write(tm+1);for cyc2:= 1 to k do write
(0); tm:=s-10;k:=0; end;
        end;
    end;
    if k=0 then write(tm) else
         begin if tm<>9 then write(tm); for cyc2:= 1 to k do write
(9);end;
end.
Re: 28K only
Posted by Effort 30 Apr 2004 22:29
Why don't you try this?
4
9 0
9 0
9 0
1 9
I'm sure that your answer is wrong!
But!
You got AC!
ft......
I have no idea about the test system!
Re: 28K only
Posted by Andrei Moga 30 Apr 2004 22:42
In your example there will be 5 digits and n is only 4.
I've got accepted too in the same ideea