From c271098d32267068232736bc3592187568138dbe Mon Sep 17 00:00:00 2001 From: qbobl5 <113408131+qbobl5@users.noreply.github.com> Date: Mon, 2 Jun 2025 10:09:02 +0900 Subject: [PATCH] =?UTF-8?q?[250602]=20B2749=20=ED=94=BC=EB=B3=B4=EB=82=98?= =?UTF-8?q?=EC=B9=98=20=EC=88=98=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qbobl5/week16/B2749.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 qbobl5/week16/B2749.java diff --git a/qbobl5/week16/B2749.java b/qbobl5/week16/B2749.java new file mode 100644 index 0000000..bca8646 --- /dev/null +++ b/qbobl5/week16/B2749.java @@ -0,0 +1,19 @@ +import java.io.*; + +public class B2749 { + static final int MOD = 1000000; + static final int PISANO = 1500000; + + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + long N = Long.parseLong(br.readLine()); + int size = (int)(N % PISANO); + + int[] dp = new int[size + 1]; + dp[0] = 0; + dp[1] = 1; + + for(int i=2; i<=size; i++) dp[i] = (dp[i - 1] + dp[i - 2]) % MOD; + System.out.println(dp[size]); + } +}