From 5b11a54ead13fb9b02751a6649b92de38e2d475e Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Fri, 8 Aug 2025 23:28:34 +0900 Subject: [PATCH] =?UTF-8?q?[20250808]=20BOJ=20/=20G5=20/=201,=202,=203=20?= =?UTF-8?q?=EB=8D=94=ED=95=98=EA=B8=B0=204=20/=20=EA=B9=80=EC=88=98?= =?UTF-8?q?=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\353\215\224\355\225\230\352\270\260 4.md" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "suyeun84/202508/08 BOJ G5 1, 2, 3 \353\215\224\355\225\230\352\270\260 4.md" diff --git "a/suyeun84/202508/08 BOJ G5 1, 2, 3 \353\215\224\355\225\230\352\270\260 4.md" "b/suyeun84/202508/08 BOJ G5 1, 2, 3 \353\215\224\355\225\230\352\270\260 4.md" new file mode 100644 index 00000000..a0aa3b26 --- /dev/null +++ "b/suyeun84/202508/08 BOJ G5 1, 2, 3 \353\215\224\355\225\230\352\270\260 4.md" @@ -0,0 +1,28 @@ +```java +import java.io.*; +import java.util.*; + +public class boj15989 { + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static StringTokenizer st; + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + + public static void main(String[] args) throws Exception { + nextLine(); + int T = nextInt(); + for (int tc = 0; tc < T; tc++) { + nextLine(); + int n = nextInt(); + int[] dp = new int[n+1]; + dp[0] = 1; + for (int i = 1; i <= 3; i++) { + for (int j = i; j <= n; j++) { + dp[j] += dp[j-i]; + } + } + System.out.println(dp[n]); + } + } +} +```