Pagini recente » Cod sursa (job #3237078) | Cod sursa (job #3295516) | Cod sursa (job #1441783) | Cod sursa (job #2258660) | Cod sursa (job #590551)
Cod sursa(job #590551)
var f,g:text;
p,a,x:longint;
function nr(q:longint):longint;
begin
nr:=0;
while q mod 5=0 do begin
q:=q div 5;
nr:=nr+1; end;
end;
begin
assign (f,'fact.in');assign (g,'fact.out');
reset(f);rewrite(g);
read (f,p);
if p=0 then
write (g,1)
else begin
a:=0; x:=0;
while a<p do begin
x:=x+5;
a:=a+nr(x);end;
if a=p then
write (g,x)
else
write (g,-1);end;
close (g);
end.