File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments