We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e09b54a commit 2083d1aCopy full SHA for 2083d1a
LiiNi-coder/202512/01 BOJ 타일 채우기.md
@@ -0,0 +1,32 @@
1
+```java
2
+import java.io.*;
3
+import java.util.*;
4
+
5
+public class Main {
6
+ public static void main(String[] args) throws IOException {
7
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
8
+ int N = Integer.parseInt(br.readLine());
9
+ if(N % 2 == 1) {
10
+ System.out.println(0);
11
+ return;
12
+ }
13
14
15
+ int[] dp = new int[N + 1];
16
+ dp[0] = 1;
17
+ dp[2] = 3;
18
19
+ for(int i = 4; i <= N; i += 2){
20
+ //dp[i-2]에 3개 패턴적용
21
+ dp[i] = dp[i - 2] * 3;
22
+ //짝수 이전 칸에 2개 패턴적용
23
+ for(int j = i - 4; j >= 0; j -= 2){
24
+ dp[i] += dp[j] * 2;
25
26
27
28
+ System.out.println(dp[N]);
29
30
+}
31
32
+```
0 commit comments