Pagini recente » Cod sursa (job #1248026) | Cod sursa (job #2057868) | Cod sursa (job #1152867) | Cod sursa (job #2761369) | Cod sursa (job #394866)
Cod sursa(job #394866)
program factorial;
var p,c,f,g:longint;
n:int64;
i,o:text;
begin
assign(i,'fact.in');
reset(i);
read(i,p);
assign(o,'fact.out');
rewrite(o);
if p=0 then
write(o,'1')
else
begin
c:=0;
f:=0;
n:=0;
repeat
n:=n+5;
c:=c+1;
g:=c;
while g mod 5=0 do
begin
f:=f+1;
g:=g div 5
end
until c+f>=p;
if c+f=p then
write(o,n)
else
write(o,'-1')
end;
close(o)
end.