We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cfd8742 commit 6761a4cCopy full SHA for 6761a4c
Baekjoon/Q9084.py
@@ -0,0 +1,15 @@
1
+# link: https://www.acmicpc.net/problem/9084
2
+
3
+T = int(input())
4
5
+for _ in range(T):
6
+ N = int(input())
7
+ coins = list(map(int, input().split()))
8
+ M = int(input())
9
+ result = [0 for _ in range(M+1)] # 인덱스가 특정 금액이고, 값이 경우의 수인 배열 (즉, 특정 금액을 만드는 경우의 수)
10
+ result[0] = 1
11
+ for coin in coins:
12
+ for price in range(1, M+1):
13
+ if price - coin >= 0: # 특정 금액을 coin을 사용해 만들 수 있는 경우 (coin에 어떤 값을 더해서 만들 수 있는 경우)
14
+ result[price] += result[price - coin] # coin을 더해서 만들 수 있는 경우의 수를 더함
15
+ print(result[M])
0 commit comments