Cod sursa(job #150194)
| Utilizator | Data | 6 martie 2008 18:40:31 | |
|---|---|---|---|
| Problema | Factorial | Scor | 25 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 kb |
program fact;
uses crt;
var p,n,aux:longint;
put:byte;
f,g:text;
begin
assign(f,'fact.in');reset(f);
assign(g,'fact.out');rewrite(g);
readln(f,p);
n:=0;
while p>0 do begin
inc(n,5);
put:=0;
aux:=n;
while aux mod 5=0 do begin
inc(put);
aux:=aux div 5;
end;
p:=p-put;
end;
if p<0 then writeln(g,-1)
else writeln(g,n);
close(f);
close(g);
end.