Pagini recente » Cod sursa (job #285403) | Cod sursa (job #2731335) | Cod sursa (job #2857774) | Cod sursa (job #1131265) | Cod sursa (job #732736)
Cod sursa(job #732736)
var r,j,d,i,h,x:longint;f,g:text;
function faktor(n:longint):real;
begin
if n=1 then
faktor:=1
else
faktor:=n*faktor(n-1);
end;
begin
assign(f,'pascal.in');assign(g,'pascal.out');reset(f);read(f,r,d);close(f);if odd(r) then x:=r div 2 else x:=r div 2-1;
for i:=1 to x do
if trunc((faktor(r)/(faktor(r-i)*faktor(i)))) mod d=0 then
h:=h+2;
if not odd(r) then begin i:=i+1;
if trunc((faktor(r)/(faktor(r-i)*faktor(i)))) mod d=0 then
h:=h+1;end;
rewrite(g);write(g,h);close(g);
end.