Pagini recente » Cod sursa (job #1941210) | Cod sursa (job #2873476) | Cod sursa (job #1976299) | Cod sursa (job #518805) | Cod sursa (job #187337)
Cod sursa(job #187337)
var n,p:longint;
f:text;
procedure citire;
var f:text;
begin
assign(f,'fact.in');
reset(f);
read(f,p);
close(f);
end;
function cinci(m,x,putere:longint):longint;
begin
if (p>=m)or(p>=m-putere) then cinci:=cinci(m+x,x*5,putere+1)
else begin cinci:=m-x div 5; n:=n+x div 5 end
end;
begin
citire;
assign(f,'fact.out');
rewrite(f);
n:=0;
if p=0 then write (f,'1')
else begin while p>0 do p:=p-cinci(0,1,0);
write(f,n);
end;
close(f);
end.