728x90
๐๋ฌธ์ ๋งํฌ
https://www.acmicpc.net/problem/14945
๐ป์ฝ๋
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[][] room = new int[N + 1][N + 1];
// n์ด 2์ธ ๊ฒฝ์ฐ
room[2][1] = 2;
// n์ด 3 ์ด์์ธ ๊ฒฝ์ฐ
for (int i = 3; i <= N; i++) {
for (int j = 1; j < N; j++) {
room[i][j] = 2 * room[i - 1][j] + room[i - 1][j - 1] + room[i - 1][j + 1];
room[i][j] %= 10007;
}
}
int answer = 0;
for (int i = 1; i < N; i++) {
answer += room[N][i];
answer %= 10007;
}
System.out.print(answer);
}
}
โณํ๊ณ
- ์ฐธ๊ณ ์๋ฃ๋ฅผ ๋ด๋ ์ ํ์์ด ์ ์ดํด๊ฐ ์๋๋ค
- https://howudong.tistory.com/214
728x90
'Algorithm > Baekjoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [Algorithm/Baekjoon] ๊ฐ๋ฏธ๊ตด - 14725(G3/JAVA) (3) | 2024.12.09 |
|---|---|
| [Algorithm/Baekjoon] ๊ณ ๋ฅ์ด - 16472(G4/JAVA) (1) | 2024.12.05 |
| [Algorithm/Baekjoon] ์์ ๋คํธ์ํน ์ดํ๋ฆฌ์ผ์ด์ - 7511(G5/JAVA) (1) | 2024.11.18 |
| [Algorithm/Baekjoon] ๋๋ฌด ์๋ฅด๊ธฐ - 14247(S2/JAVA) (1) | 2024.11.11 |
| [Algorithm/Baekjoon] ์ ์ ์ - 12893 (G4/JAVA) (1) | 2024.11.04 |