We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 510d6e5 commit a4de5a9Copy full SHA for a4de5a9
1 file changed
Seol-JY/202512/03 BOJ G5 합분해.md
@@ -0,0 +1,32 @@
1
+```java
2
+
3
+import java.io.*;
4
+import java.util.*;
5
6
+public class Main {
7
+ static final int MOD = 1_000_000_000;
8
9
+ public static void main(String[] args) throws IOException {
10
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
11
+ StringTokenizer st = new StringTokenizer(br.readLine());
12
13
+ int N = Integer.parseInt(st.nextToken());
14
+ int K = Integer.parseInt(st.nextToken());
15
16
+ int[][] dp = new int[K + 1][N + 1];
17
18
+ for (int n = 0; n <= N; n++) {
19
+ dp[1][n] = 1;
20
+ }
21
22
+ for (int k = 2; k <= K; k++) {
23
+ dp[k][0] = 1;
24
+ for (int n = 1; n <= N; n++) {
25
+ dp[k][n] = (dp[k][n - 1] + dp[k - 1][n]) % MOD;
26
27
28
29
+ System.out.println(dp[K][N]);
30
31
+}
32
+```
0 commit comments