Pagini recente » Cod sursa (job #1624813) | Cod sursa (job #2579494) | Cod sursa (job #3125219) | Cod sursa (job #1272497) | Cod sursa (job #1631550)
var y,x,i,p:int64;
b:boolean;
function nz(x:int64):int64;
var q:int64;
begin
q:=0;
while (x <> 0) do
if x mod 10 = 0 then begin q:=q+1; x:=x div 10; end 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;
b:=false;
x:=1;
i:=1;
y:=trunc(exp(ln(10)*p));
while (i<>0) do
begin
x:=x*i;
b:=nz(x)=p;
if b then ecrire(i);
if b then break;
if x>y then x:=x mod y;
i:=i+1;
end;
end.