8000 Merge pull request #272 from SciEm/11057_1.cpp · w10gd/basic-algo-lecture@4364f67 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4364f67

Browse files
Merge pull request encrypted-def#272 from SciEm/11057_1.cpp
Update 11057_1.cpp
2 parents 4f0d087 + 66d5a17 commit 4364f67

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

0x10/solutions/11057_1.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
0