comm.h
来自「经典数据结构书籍 数据结构C++语言描述 的源代码 很难找的哦」· C头文件 代码 · 共 16 行
H
16 行
// determine the number of committees with k members that
// can be chosen from n persons
int comm (int n, int k)
{
// stopping condition; too few persons
if (k > n)
return 0;
// stopping condition; committee of the whole or 0 members
else if (n == k || k == 0)
return 1;
else
// recursive step: all committes without person A
// + all committees that include person A
return comm(n-1,k) + comm(n-1,k-1);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?