Pagini recente » Cod sursa (job #1304390) | Cod sursa (job #250166) | Cod sursa (job #2929214) | Cod sursa (job #2083673) | Cod sursa (job #211491)
Cod sursa(job #211491)
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;
if factorial=0 then factorial:=1;
end;
begin
assign(f,'pascal.in'); reset(f);
assign(g,'pascal.out'); rewrite(g);
readln(f,r,d); i:=r;
for j:=0 to r do
v[j+1]:=factorial(i) div (factorial(i-j)*factorial(j));
for i:=1 to r+1 do
if (v[i] mod d =0) then count:=count+1;
writeln(g,count); close(g);
end.