组合数:
AC代码:
#include <iostream> #include <cstdio> #include <cstring> using namespace std; int c[1010][1010]; int main() { int t, n, k; for(int i = 0; i < 1001; i++) c[i][0] = 1; for(int i = 1; i < 1001; i++) { for(int j = 1; j < 1001; j++) { c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % 10000003; } } scanf("%d", &t); while(t--) { scanf("%d%d", &n, &k); printf("%d\n", c[n][k]); } return 0; } /************************************** Problem id : SDUT OJ D User name : xam140325乔璐 Result : Accepted Take Memory : 4464K Take Time : 20MS Submit Time : 2016-05-02 15:01:57 **************************************/
时间: 2024-10-13 22:50:50