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.
26 lines
595 B
26 lines
595 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
typedef long long LL;
|
|
const int N = 2010; //n的数值上限
|
|
|
|
int t; //t次查询
|
|
int n; //n个数字中
|
|
int m; //找m个数字组合
|
|
int C[N][N]; //组合数数组
|
|
int K = 100000;
|
|
|
|
|
|
int main() {
|
|
//预处理杨辉三角形
|
|
for (int i = 0; i < N; i++) {
|
|
//base case
|
|
C[i][0] = 1, C[i][i] = 1;
|
|
//递推生成其它组合数
|
|
for (int j = 1; j < i; j++)
|
|
C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % k;
|
|
}
|
|
cin >> n >> m;
|
|
cout << C[n][m] << endl;
|
|
}
|