原题链接:
题解:
代码:
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
int n;
const LL mod = 1e9 + 7;
const int N = 2e3 + 10;
LL f[N][N];
int main() {
cin >> n;
for (int i = 0;i <= 2000;i++) {
for (int j = 0;j <= i;j++) {
if (!j) f[i][j] = 1;
else f[i][j] = (f[i - 1][j - 1] + f[i - 1][j]) % mod;
}
}
while (n--) {
int a, b;cin >> a >> b;
cout<<f[a][b]<<endl;
}
}