From 4de98c7c97fd56c326e1740a2ee359266f24a1d7 Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Mon, 16 Feb 2026 23:45:38 +0900 Subject: [PATCH] =?UTF-8?q?[20260216]=20BOJ=20/=20=EC=95=94=ED=98=B8?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20/=20G5=20/=20=EC=9D=B4=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...24\355\230\270\354\275\224\353\223\234.md" | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 "LiiNi-coder/202602/16 BOJ \354\225\224\355\230\270\354\275\224\353\223\234.md" diff --git "a/LiiNi-coder/202602/16 BOJ \354\225\224\355\230\270\354\275\224\353\223\234.md" "b/LiiNi-coder/202602/16 BOJ \354\225\224\355\230\270\354\275\224\353\223\234.md" new file mode 100644 index 00000000..6ebb354f --- /dev/null +++ "b/LiiNi-coder/202602/16 BOJ \354\225\224\355\230\270\354\275\224\353\223\234.md" @@ -0,0 +1,39 @@ +```java +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)); + String s = br.readLine(); + int n = s.length(); + int MOD = 1_000_000; + int[] dp = new int[n + 1]; + if (s.charAt(0) == '0') { + System.out.println(0); + return; + } + + + dp[0] = 1; + dp[1] = 1; + for (int i = 2; i <= n; i++) { + char now = s.charAt(i - 1); + char previous = s.charAt(i - 2); + //한자리수 + if (now != '0') { + dp[i] = (dp[i] + dp[i - 1]) % MOD; + } + + //두자리수 + int twoDigit = (previous - '0') * 10 + (now - '0'); + if (twoDigit >= 10 && twoDigit <= 26) { + dp[i] = (dp[i] + dp[i - 2]) % MOD; + } + } + System.out.println(dp[n]); + } +} + +```