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

I have AC
Posted by OSPU 15 Mar 2003 13:04
program a1048;
const nn=500003;
var a:array[0..nn] of byte;
i,j,c,b,n:longint;

procedure mass(i:longint;x:byte);
begin
if i mod 2=0 then a[i div 2]:=(a[i div 2] mod 10)+x*10
else a[i div 2]:=(a[i div 2] div 10)*10+x;
end;

function mas(i:longint):byte;
begin
if i mod 2 =0 then mas:=a[i div 2] div 10
else mas:=a[i div 2] mod 10;
end;

begin
fillchar(a,SizeOf(a),0);
readln(n);
for i:=1 to n do
   begin
   readln(b,c);
   b:=b+c;
   for j:=i downto 1do
      begin
      b:=b+mas(j);
      mass(j,b mod 10);
      b:=b div 10;
      if b=0 then break;
      end;
   end;
for i:=1 to n do
   write(mas(i));
writeln;
end.
OK, please, stop do it! If you're so clever, don't post your AC's on the board (-)
Posted by Dmitry 'Diman_YES' Kovalioff 15 Mar 2003 13:47
I agree lord, don`t continue pasting AC :) (-)
Posted by Locomotive 15 Mar 2003 17:00
>
Re: I have AC
Posted by SunMoonStar 16 Mar 2003 19:34
What a long, slow, big program!