Pagini recente » Rating Popa Stefan Andrei (StefanAndrei21) | Cod sursa (job #2947621) | Cod sursa (job #229696) | Cod sursa (job #1455231) | Cod sursa (job #211484)
Cod sursa(job #211484)
program swastika;
var i,j,r,d,count:integer;
f,g:text;
v:array[1..100] of integer;
function factorial(a:integer):integer;
var h:integer;
begin
factorial:=1;
for h:=1 to a do
factorial:=factorial*h;
end;
begin
assign(f,'pascal.in'); reset(f);
assign(g,'pascal.out'); rewrite(g);
readln(f,r,d); i:=r;
if (d>1) and (d<7) then
begin
for j:=1 to r+1 do
v[j+1]:=factorial(i) div (factorial(i-j)*factorial(j));
v[1]:=1;
for i:=1 to r+1 do
if (v[i] mod d =0) then count:=count+1;
writeln(g,count); close(g);
end;
end.