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

my solve
Posted by gyz113 12 Feb 2008 11:56
It is vr easy.
Var i,j,k:longint;
    a:array[0..1000000] of shortint;
Begin
 readln(k);
 for i:=1 to k do begin readln(a[i],j); inc(a[i],j); end;
 for i:=k downto 1 do
  while a[i]>9 do
   begin dec(a[i],10); inc(a[i-1],1); end;
 i:=0;
 while (a[i]=0)and(i<1) do inc(i);
 for j:=i to k do write(a[j]); writeln;
End.