Cod sursa(job #67636)

Utilizator ProtomanAndrei Purice Protoman Data 25 iunie 2007 12:55:07
Problema Sarpe Scor 0
Compilator fpc Status done
Runda preONI 2007, Runda Finala, Clasa a 9-a si gimnaziu Marime 0.62 kb
var i,j,h,x,n:longint;
    f1,f2:text;
    a:array[1..1000000] of longint;

procedure putere;
begin
     for j:=1 to x do
     begin
          h:=a[j]*2+h;
          a[j]:=h mod 10;
          h:=h div 10;
     end;
     if h>0 then
     begin
          inc(x);
          a[x]:=h;
          h:=0;
     end;
end;

begin
     assign(f1,'sarpe.in');
     reset(f1);
     assign(f2,'sarpe.out');
     rewrite(f2);
     read(f1,n);
     a[1]:=1;
     x:=1;
     if n>1 then
        for i:=1 to n+1 do
            putere;
     for i:=x downto 1 do
         write(f2,a[i]);
     close(f1);
     close(f2);
end.