Pagini recente » Cod sursa (job #464688) | Cod sursa (job #2535473) | Cod sursa (job #3251077) | Cod sursa (job #1982193) | Cod sursa (job #604346)
Cod sursa(job #604346)
program factorial;
var p,i:longint;
rez:real;
f,g:text;
cond:boolean;
aux:int64;
begin
assign (f,'fact.in'); reset (f);
assign (g,'fact.out'); rewrite (g);
read (f,p);
aux:=5;
cond:=false;
for i:=2 to 13 do begin if (aux=p) then begin cond:=true;
break;
end;
aux:=aux*5;
end;
if (p<>0) and (cond<>true) then begin rez:=int(5*(p-int(ln(5*p)/ln(5)-1)));
write (g,rez:10:0);
end
else if (p=0) then write (g,'1')
else if (cond) then write (g,'-1');
close (f);
close (g);
end.