Pagini recente » Cod sursa (job #590226) | Cod sursa (job #316538) | Cod sursa (job #610478)
Cod sursa(job #610478)
Program patrate2;
const aux='1073741824';
var a:array [0..1000000] of byte;
b1:array [1..1 shl 15] of char;
s:string;
i,j,n,l,cod:longint;
fi,fo:text;
procedure inmulteste(n:integer);
var t,i,s,code:integer;
s2:string;
begin
t:=0;
for i:=l downto 1 do begin
s:=n*a[i]+t;
t:=s div 10;
a[i]:=s mod 10;
end;
if t>0 then begin
str(t,s2);
l:=l+length(s2);
for i:=l downto length(s2)+1 do a[i]:=a[i-length(s2)];
for i:=1 to length(s2) do val(s2[i],a[i],code);
end;
end;
begin
assign(fi,'patrate2.in');
assign(fo,'patrate2.out');
settextbuf(fo,b1);
reset(fi);
rewrite(fo);
readln(fi,n);
l:=1; a[1]:=1;
if n*n<30 then begin
str(1 shl n,s);
l:=length(s);
for i:=1 to length(s) do val(s[i],a[i],cod);
end
else begin
l:=10;
for i:=1 to 10 do val(aux[i],a[i],cod);
for i:=31 to n*n do inmulteste(2);
end;
for i:=2 to n do inmulteste(i);
for i:=1 to l do write(fo,a[i]);
close(fo);
end.