We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fcdbb41 commit 4a61aadCopy full SHA for 4a61aad
Combination(Recursion).cpp
@@ -0,0 +1,32 @@
1
+#include <cstdio>
2
+
3
+#define MOD 1000000000
4
+#define MAX 1000
5
6
+int C[MAX][MAX];
7
8
+void init_C()
9
+{
10
+ for (int i = 0; i < MAX; i++)
11
+ {
12
+ C[i][0] = 1;
13
+ }
14
+ for (int i = 1; i < MAX; i++)
15
16
+ for (int j = 1; j <= i; j++)
17
18
+ C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % MOD;
19
20
21
+}
22
23
+int main()
24
25
+ int n, m;
26
+ init_C();
27
+ while (scanf("%d%d", &n, &m) > 0)
28
29
+ printf("%d\n", C[n][m]);
30
31
+ return 0;
32
0 commit comments