BCDIV - Chia nhóm
Tác giả: RR
Ngôn ngữ: Pascal
{$R-,Q-}
const
FINP='';
FOUT='';
MAXN=25;
var
d:array[0..MAXN,0..MAXN] of double;
n,k,test,t:longint;
f1,f2:text;
procedure openF;
begin
assign(f1,FINP); reset(f1);
assign(f2,FOUT); rewrite(f2);
end;
procedure closeF;
begin
close(f1); close(f2);
end;
procedure init;
var
i,j:longint;
begin
d[1,1]:=1;
for i:=2 to 25 do
for j:=1 to i do
d[i,j]:=d[i-1,j]*j+d[i-1,j-1];
end;
begin
openF;
init;
read(f1,t);
for test:=1 to t do
begin
read(f1,n,k);
writeln(f2,d[n,k]:0:0);
end;
closeF;
end.