Pagini recente » Cod sursa (job #1626128) | Cod sursa (job #2466751) | Cod sursa (job #2346891) | Cod sursa (job #2283807) | Cod sursa (job #195621)
Cod sursa(job #195621)
var f,g:text;
a,b,c,t,p:longint;
function zero(c:longint):longint;
var p:longint;
begin
zero:=0;
p:=5;
while p<=c do begin
inc(zero,c div p);
p:=p*5;
end;
end;
begin
assign(f,'fact.in');reset(f);
assign(g,'fact.out');rewrite(g);
read(f,p);
a:=1;
b:=100000000;
t:=0;
while (a<=b) do begin
c:=(a+b) div 2;
if zero(c)<p then a:=c+1;
if zero(c)>p then b:=c-1;
if zero(c)=p then begin
writeln(g,c);
inc(t);
break;
end;
end;
if t=0 then writeln(g,'-1');
close(f);
close(g);
end.