- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2225.java
More file actions
Latest commit
28 lines (20 loc) · 571 Bytes
/
Copy path2225.java
File metadata and controls
28 lines (20 loc) · 571 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
importjava.util.*;
publicclassMain {
publicstaticvoidmain(String[] args) {
Scannersc = newScanner(System.in);
intn = sc.nextInt();
intk = sc.nextInt();
intmod = 1000000000;
int [][] d = newint[k+1][n+1];
d[0][0] = 1;
for(inti=1; i<k+1; i++) {
for(intj=0; j<n+1; j++) {
for(intx=0; x<=j; x++) {
d[i][j] += d[i-1][j-x];
d[i][j] %= mod;
}
}
}
System.out.println(d[k][n]);
}
}