From f0d8c19f7d6748c3a2d2557867d98bc1251f858e Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Sun, 3 Aug 2025 21:27:33 +0900 Subject: [PATCH] =?UTF-8?q?[20250803]=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=9D=B4?= =?UTF-8?q?=EA=B0=95=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \354\261\204\354\232\260\352\270\260.md" | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 "lkhyun/202508/03 BOJ G4 \355\203\200\354\235\274 \354\261\204\354\232\260\352\270\260.md" diff --git "a/lkhyun/202508/03 BOJ G4 \355\203\200\354\235\274 \354\261\204\354\232\260\352\270\260.md" "b/lkhyun/202508/03 BOJ G4 \355\203\200\354\235\274 \354\261\204\354\232\260\352\270\260.md" new file mode 100644 index 00000000..938c2328 --- /dev/null +++ "b/lkhyun/202508/03 BOJ G4 \355\203\200\354\235\274 \354\261\204\354\232\260\352\270\260.md" @@ -0,0 +1,30 @@ +```java +import java.util.*; +import java.io.*; + +public class Main { + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st; + static int N; + static int[] dp; + + public static void main(String[] args) throws Exception { + int N = Integer.parseInt(br.readLine()); + if(N%2 == 1){ + bw.write("0"); + bw.close(); + return; + } + + dp = new int[N+1]; + dp[0] = 1; + dp[2] = 3; + for (int i = 4; i <= N; i++) { + dp[i] = 4*dp[i-2] - dp[i-4]; + } + bw.write(dp[N]+""); + bw.close(); + } +} +```