Pagini recente » Cod sursa (job #418155) | Cod sursa (job #183123) | Cod sursa (job #1953357) | Cod sursa (job #2688322) | Cod sursa (job #29504)
Cod sursa(job #29504)
var f,g:text;
nat,x,p,a,b:longint;
c:real;
ok:boolean;
function putere(m:real):longint;
var put:longint;
begin
put:=0;
while m>0 do
begin
put:=put + trunc(m) div 5;
m:=trunc(m) div 5;
end;
putere:=put;
end;
begin
assign(f,'in.txt');reset(f);
assign(g,'out.txt');rewrite(g);
readln(f,p);
a:=0;
b:=20000*100000;
ok:=false;
if p=0 then write(g,'1') else
if p=1 then write(g,'5') else
if p>=2 then
while a<b do
begin
c:=(a+b)/2;
x:=putere(c);
if x=p then
begin
nat:=trunc(c) - trunc(c) mod 5;
writeln(g,nat);
a:=b+1;
ok:=true;
end;
if x<p then a:=trunc(c)+1;
if x>p then b:=trunc(c)-1;
end;
if (p>=2) and (ok=false) then writeln(g,-1);
close(f);
close(g);
end.