728x90
📑문제링크
https://www.acmicpc.net/problem/11057
💻코드
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
int[][] dp = new int[1002][10];
for (int i = 0; i < 10; i++) {
dp[1][i] = 1;
}
for (int i = 2; i <= N; i++) {
for (int j = 0; j < 10; j++) {
if (j == 0) {
dp[i][j] = 1;
continue;
}
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
dp[i][j] %= 10007;
}
}
int answer = 0;
for (int i = 0; i < 10; i++) {
answer += (dp[N][i] % 10007);
}
System.out.println(answer % 10007);
}
}
728x90
'Algorithm > Baekjoon' 카테고리의 다른 글
[Algorithm/Baekjoon] 단지번호붙이기 - 2667 (S1/JAVA) (0) | 2024.10.21 |
---|---|
[Algorithm/Baekjoon] 떡 돌리기 - 20007 (S1/JAVA) (0) | 2024.10.07 |
[Algorithm/Baekjoon] 풍선 맞추기 - 11509 (G5/JAVA) (0) | 2024.09.26 |
[Algorithm/Baekjoon] 거의 소수 - 1456 (G5/JAVA) (0) | 2024.09.09 |
[Algorithm/Baekjoon] 부분수열의 합 - 1182 (S2/JAVA) (0) | 2024.09.02 |