8000
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 816221b commit 66d5a17Copy full SHA for 66d5a17
0x10/solutions/11057_1.cpp
@@ -0,0 +1,32 @@
1
+// Authored by : SciEm
2
+// Co-authored by : -
3
+// http://boj.kr/581d0c95a5fc40aba608214528b21a75
4
+#include <bits/stdc++.h>
5
+using namespace std;
6
+
7
+const int mod = 10007;
8
+int n;
9
+int comb[1010][10];
10
11
+int main() {
12
+ ios::sync_with_stdio(0);
13
+ cin.tie(0);
14
15
+ cin >> n;
16
17
+ for (int i = 1; i <= 9; i++)
18
+ comb[i][i] = 1;
19
20
+ for (int i = 1; i <= n + 9; i++) {
21
+ comb[i][0] = 1;
22
+ for (int j = 1; j < min(i, 10); j++)
23
+ comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % mod;
24
+ }
25
26
+ cout << comb[n + 9][9];
27
+}
28
+/*
29
+n 오르막 수의 개수는 0부터 9까지 10개의 수 중에서 n개를 중복하여 택하는 경우의 수와 같다.
30
+H(10, n) = C(n + 9, n) = C(n + 9, 9)를 comb[n][r]배열을 통해 구한다. (0x12강 참고)
31
+또한, 매번 C(i, 9)까지만 계산했다.
32
+*/
0 commit comments