You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
633 B

#include<cstdio>
using namespace std;
typedef long long LL;
//帕斯卡公式求组合数,与埃筛、欧筛类似,是预处理中好多,再慢慢用
const int N = 2010; //n的数值上限
LL C[N][N]; //组合数数组
void C3() {
//预处理杨辉三角形
for (int i = 0; i < N; i++) {
//base case
C[i][0] = C[i][i] = 1; //组合数C(n,0)=1 组合数C(n,n)=c(n,0)=1
//递推生成其它组合数
for (int j = 1; j < i; j++)
C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]);
}
}
int main() {
C3();
printf("%lld\n", C[54][17]);
return 0;
}