Cod sursa(job #704271)
Utilizator | Torok Istvan tgistvan | Data | 2 martie 2012 17:13:39 |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
var o,i,ot,n,j,k:int64;
jo:boolean;
f,g:text;
procedure te;
begin
o:=0;
while j mod 5=0 do begin
j:=j div 5;
o:=o+1;
end;
end;
begin
assign(f,'fact.in');reset(f);
readln(f,k); close(f);
jo:=true;
n:=1;
while jo do begin
n:=n+1;
ot:=0;
i:=2;
while i<=n do begin
j:=i;
te;
ot:=ot+o;
inc(i);
end;
{writeln(ot); }
if ot>=k then jo:=false;
end;
assign(g,'fact.out');rewrite(g);
if ot=k then writeln(g,n)
else writeln(g,-1);
close(g);
end.