20251128 baekjoon
This commit is contained in:
parent
defda6b1d1
commit
aad4587ea1
13
code_study/Baekjoon/python/12865.py
Normal file
13
code_study/Baekjoon/python/12865.py
Normal file
@ -0,0 +1,13 @@
|
||||
import sys
|
||||
input = sys.stdin.readline
|
||||
|
||||
N, K = map(int, input().split())
|
||||
items = [list(map(int, input().split())) for _ in range(N)]
|
||||
|
||||
dp = [0]*(K+1)
|
||||
|
||||
for w, v in items :
|
||||
for k in range(K, w-1, -1) :
|
||||
dp[k] = max(dp[k-w] + v, dp[k])
|
||||
|
||||
print(dp[K])
|
||||
Loading…
x
Reference in New Issue
Block a user