From b2ed5eb5f0a903f9b1299e26317cd15367282998 Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Mon, 22 Sep 2025 23:37:36 +0900 Subject: [PATCH] =?UTF-8?q?[20250922]=20PGM=20/=20LV3=20/=20=EA=B1=B0?= =?UTF-8?q?=EC=8A=A4=EB=A6=84=EB=8F=88=20/=20=EA=B9=80=EC=88=98=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60\354\212\244\353\246\204\353\217\210.md" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "suyeun84/202509/22 PGM LV3 \352\261\260\354\212\244\353\246\204\353\217\210.md" diff --git "a/suyeun84/202509/22 PGM LV3 \352\261\260\354\212\244\353\246\204\353\217\210.md" "b/suyeun84/202509/22 PGM LV3 \352\261\260\354\212\244\353\246\204\353\217\210.md" new file mode 100644 index 00000000..21d91317 --- /dev/null +++ "b/suyeun84/202509/22 PGM LV3 \352\261\260\354\212\244\353\246\204\353\217\210.md" @@ -0,0 +1,22 @@ +```java +class Solution { + public int solution(int n, int[] money) { + int answer = 0; + final int MOD = 1000000007; + int[][] dp = new int[money.length + 1][n + 1]; + + for (int i = 1; i < money.length+1; i++) { + for (int j = 0; j <= n; j++) { + if (j == 0) { + dp[i][j] = 1; + } else if (j - money[i-1] >= 0) { + dp[i][j] = (dp[i - 1][j] + dp[i][j - money[i - 1]]) % MOD; + } else + dp[i][j] = dp[i - 1][j]; + } + } + + return dp[money.length][n]; + } +} +```