$ C_{a}^{b}=C_{a-1}^{b-1}+C_{a-1}^{b} $
C++ 代码
/*
* @Author: lzyws739307453
* @Language: C++
*/
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000, MAXM = 2005;
const int MOD = 1e9 + 7;
int C[MAXM][MAXM];
void Com_Num(int n) {
C[0][0] = 1;
for (int i = 0; i <= n; i++) {
C[i][0] = 1;
for (int j = 1; j <= i; j++)
C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
}
}
int main() {
int t;
Com_Num(MAXN);
scanf("%d", &t);
while (t--) {
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", C[a][b]);
}
return 0;
}