Cod sursa(job #630735)
| Utilizator | Data | 6 noiembrie 2011 14:36:10 | |
|---|---|---|---|
| Problema | Factorial | Scor | 100 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.81 kb |
program p1;
var fi,fo:text;
p,n,m,s:longint;
BEGIN
assign(fi,'fact.in'); reset(fi);
assign(fo,'fact.out'); rewrite(fo);
read(fi,p);
if p=0 then write(fo,1) else begin
n:=p*4;
repeat
m:=5; s:=0;
while m<=n do begin
inc(s,n div m);
m:=m*5;
end;
inc(n);
until s>=p;
if s=p then write(fo,n-1)
else write(fo,'-1');
end;
close(fi); close(fo);
END.