-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAscent.java
More file actions
37 lines (27 loc) · 622 Bytes
/
Ascent.java
File metadata and controls
37 lines (27 loc) · 622 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
29
30
31
32
33
34
35
36
37
package dynamic;
import java.util.Scanner;
public class Ascent {
static final int MOD = 10007;
public static void main(String[] args) {
// #11057¹ø ¿À¸£¸· ¼ö
long ans = 0;
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[][] dp = new long[n+1][10];
for(int i=0; i<=9; i++) {
dp[1][i] = 1;
}
for(int i=2; i<=n; i++) {
for(int j=0; j<10; j++) {
for(int k=0; k<=j; k++) {
dp[i][j] += dp[i-1][k];
}
dp[i][j] %= MOD;
}
}
for(int i=0; i<10; i++) {
ans += dp[n][i];
}
System.out.println(ans%MOD);
}
}