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 | package n11057; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[][] dp = new long[n+1][11]; for(int i = 0; i < 10; i++){ dp[1][i] = 1; } for(int i = 2; i < n+1; i++){ for(int j = 0; j < 10; j++){ for(int k = 0; k < 10; k++){ if( j - k >= 0){ dp[i][j] += dp[i-1][j-k]; } } // dp[i][j] += dp[i-1][j]; dp[i][j] %= 10007; } } long result = 0; for(int i = 0; i<10; i++){ result += dp[n][i]; } result = result%10007; System.out.println(result); } } | cs |
'알고리즘 > 백준 알고리즘' 카테고리의 다른 글
[code.plus 알고리즘 기초] no. 10844 (0) | 2019.01.23 |
---|---|
[code.plus 알고리즘 기초] no. 2193 (0) | 2019.01.22 |
[code.plus 알고리즘 기초] no. 11052 (0) | 2019.01.21 |
[code.plus 알고리즘 기초] no. 9095 (0) | 2019.01.19 |
[code.plus 알고리즘 기초] no. 11727 (0) | 2019.01.17 |