Skip to content

Commit 6c96c5b

Browse files
authored
Merge pull request #1038 from AlgorithmWithGod/zinnnn37
[20251004] BOJ / G5 / 합분해 / 김민진
2 parents 14976af + 68a0f9b commit 6c96c5b

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
```java
2+
import java.io.*;
3+
import java.util.Arrays;
4+
import java.util.StringTokenizer;
5+
6+
public class BJ_2225_합분해 {
7+
8+
private static final int MOD = 1_000_000_000;
9+
10+
private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
11+
private static final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
12+
private static StringTokenizer st;
13+
14+
private static int N, K;
15+
private static int[] dp;
16+
17+
public static void main(String[] args) throws IOException {
18+
init();
19+
sol();
20+
}
21+
22+
private static void init() throws IOException {
23+
st = new StringTokenizer(br.readLine());
24+
N = Integer.parseInt(st.nextToken());
25+
K = Integer.parseInt(st.nextToken());
26+
27+
dp = new int[N + 1];
28+
Arrays.fill(dp, 1);
29+
}
30+
31+
private static void sol() throws IOException {
32+
for (int j = 1; j < K; j++) {
33+
for (int i = 1; i <= N; i++) {
34+
dp[i] = (dp[i - 1] + dp[i]) % MOD;
35+
}
36+
}
37+
bw.write(dp[N] + "\n");
38+
bw.flush();
39+
bw.close();
40+
br.close();
41+
}
42+
43+
}
44+
```

0 commit comments

Comments
 (0)