Skip to content

Commit e4858cb

Browse files
authored
feat: 3월 3주차 발제 자료 업로드 (DP)
1 parent ee6ecef commit e4858cb

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'''
2+
BOJ #2293. 동전 1 (골드4)
3+
https://www.acmicpc.net/problem/2293
4+
유형: DP
5+
'''
6+
7+
n, k = map(int, input().split())
8+
9+
coin = []
10+
dp = [0] * (k + 1)
11+
12+
for _ in range(n):
13+
coin.append(int(input()))
14+
15+
coin.sort()
16+
dp[0] = 1
17+
18+
for c in coin:
19+
for i in range(c, k+1):
20+
dp[i] += dp[i-c]
21+
22+
print(dp[k])

0 commit comments

Comments
 (0)