From 25af8dffa9cf77c7692a78ee8f09ef4c2a3a3a3f Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Sat, 9 Aug 2025 23:53:07 +0900 Subject: [PATCH] =?UTF-8?q?[20250809]=20BOJ=20/=20G5=20/=20=EB=8F=99?= =?UTF-8?q?=EC=A0=84=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 --- .../09 BOJ \353\217\231\354\240\204.md" | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 "LiiNi-coder/202508/09 BOJ \353\217\231\354\240\204.md" diff --git "a/LiiNi-coder/202508/09 BOJ \353\217\231\354\240\204.md" "b/LiiNi-coder/202508/09 BOJ \353\217\231\354\240\204.md" new file mode 100644 index 00000000..591cf85d --- /dev/null +++ "b/LiiNi-coder/202508/09 BOJ \353\217\231\354\240\204.md" @@ -0,0 +1,38 @@ +```java +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.IOException; +import java.util.StringTokenizer; + +public class Main { + private static BufferedReader br; + + public static void main(String[] args) throws IOException { + br = new BufferedReader(new InputStreamReader(System.in)); + int T = Integer.parseInt(br.readLine()); + StringTokenizer st; + StringBuilder sb = new StringBuilder(); + + for (int tc = 0; tc < T; tc++) { + int n = Integer.parseInt(br.readLine()); + int[] coins = new int[n]; + st = new StringTokenizer(br.readLine()); + + for (int i = 0; i < n; i++) { + coins[i] = Integer.parseInt(st.nextToken()); + } + int target = Integer.parseInt(br.readLine()); + int[] dp = new int[target + 1]; //dp[i] i원을 만드는 경우의수 + dp[0] = 1; + for (int coin : coins) { + for (int amount = coin; amount <= target; amount++) { + dp[amount] += dp[amount - coin]; + } + } + sb.append(dp[target]).append('\n'); + } + System.out.print(sb.toString()); + br.close(); + } +} +```