From 5a5826e6ea156e46bccf02196f052c6496c99663 Mon Sep 17 00:00:00 2001 From: Jinyeong Seol Date: Mon, 1 Dec 2025 23:51:23 +0900 Subject: [PATCH] =?UTF-8?q?[20251201]=20BOJ=20/=20G4=20/=20=ED=83=80?= =?UTF-8?q?=EC=9D=BC=20=EC=B1=84=EC=9A=B0=EA=B8=B0=20/=20=EC=84=A4?= =?UTF-8?q?=EC=A7=84=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...04\354\232\260\352\270\260.md\342\200\216" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "Seol-JY/202512/01 BOJ \355\203\200\354\235\274 \354\261\204\354\232\260\352\270\260.md\342\200\216" diff --git "a/Seol-JY/202512/01 BOJ \355\203\200\354\235\274 \354\261\204\354\232\260\352\270\260.md\342\200\216" "b/Seol-JY/202512/01 BOJ \355\203\200\354\235\274 \354\261\204\354\232\260\352\270\260.md\342\200\216" new file mode 100644 index 00000000..a443aaa2 --- /dev/null +++ "b/Seol-JY/202512/01 BOJ \355\203\200\354\235\274 \354\261\204\354\232\260\352\270\260.md\342\200\216" @@ -0,0 +1,27 @@ +```java +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.IOException; + +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().trim()); + + if (n % 2 == 1) { + System.out.println(0); + return; + } + + int[] dp = new int[31]; + dp[0] = 1; + dp[2] = 3; + + for (int i = 4; i <= n; i += 2) { + dp[i] = 4 * dp[i - 2] - dp[i - 4]; + } + + System.out.println(dp[n]); + } +} +```