Pagini recente » Cod sursa (job #1585956) | Rating matei raul (AlMeu15) | Cod sursa (job #3122992) | Cod sursa (job #404476) | Cod sursa (job #1631531)
var y,x,i,p:int64;
function nz(x:int64):int64;
var q:int64;
begin
q:=0;
while (x <> 0) do
if x mod 10 = 0 then q:=q+1 else break;
nz:=q;
end;
procedure lire;
begin
assign(input,'fact.in');
reset(input);
read(p);
close(input);
end;
procedure ecrire(x:int64);
begin
assign(output,'fact.out');
rewrite(output);
write(x);
close(output);
end;
begin
lire;
x:=1;
i:=0;
y:=trunc(exp(ln(10)*p));
while (i<>0) do
begin
x:=x*i;
if nz(x)=p then begin ecrire(x); break; end;
if x>y then x:=x mod y;
i:=i+1;
end;
end.