Pagini recente » Istoria paginii runda/pushca_lui/clasament | Cod sursa (job #1653491) | Cod sursa (job #191787) | Cod sursa (job #1696455) | Cod sursa (job #1526131)
Program fact;
var p,i,f,j,n:longint;
a:array[1..100] of int64;
fi,fo:textfile;
begin
assign(fi,'fact.in');reset(fi);
assign(fo,'fact.out');rewrite(fo);
read(fi,p);
if p=0 then writeln(fo,1) else
begin
n:=0;f:=0;a[1]:=5;
while f<p do
begin
inc(n);
f:=0;
for i:=1 to n do
if i mod 5=0 then begin
inc(f);
for j:=1 to 12 do begin
a[j+1]:=a[j]*5;
if i=a[j] then f:=f+j-1;
end;
end;
if f>p then n:=-1;
end;
writeln(fo,n);
end;
close(fi);
close(fo);
end.