Pagini recente » Cod sursa (job #945736) | Cod sursa (job #2117003) | Cod sursa (job #2270576) | Cod sursa (job #55756) | Cod sursa (job #351026)
Cod sursa(job #351026)
var f,g:text;
i,j,ex,N,N2,P,P2:longint;
ok:boolean;
Begin
assign(f,'fact.in');
assign(g,'fact.out');
reset(f);
rewrite(g);
read(f,P);
ok:=false;
n:=1;
if (p>=0) and (p<=100000000) then begin
repeat
p2:=0;
n2:=1;
for i:=1 to n do n2:=(n2 mod 100000000)*i;
for j:=1 to P do begin
ex:=N2 mod 10;
if ex=0 then P2:=p2+1;
N2:=N2 div 10;
end;
if (p2=p) and (n2 mod 10<>0) then
begin
ok:=true;
write(g,n);
end;
inc(N);
until (ok=true) or (n=100);
if ok=false then write(g,-1);
end;
close(f);
close(g);
end.