Pagini recente » Cod sursa (job #2600072) | Cod sursa (job #475148) | Cod sursa (job #1463687) | Cod sursa (job #2641928) | Cod sursa (job #278909)
Cod sursa(job #278909)
var p,cnt0,cnt5,i,x,q:integer;
f,g:text;
ok:boolean;
begin
assign (f,'fact.in');
assign (g,'fact.out');
reset (f);
rewrite (g);
read (f,p);
cnt0:=p;
x:=0;
ok:=false;
cnt5:=0;
if p<>0 then
while not(ok) do
begin
x:=x+5;
q:=x;
while q>1 do
begin
if q mod 5=0 then
begin
cnt5:=cnt5+1;
q:=q div 5;
end
else
break;
if cnt5=cnt0 then
begin
ok:=true;
writeln (g,x);
end;
if cnt5>cnt0 then
begin
ok:=true;
writeln (g,'-1');
end;
end;
end
else
writeln (g,'1');
close (f);
close (g);
end.