complete at jungol 1077.py 3135.py 14020.py 3006.rs
This commit is contained in:
15
storage/jungol/py/completed/1077.py
Normal file
15
storage/jungol/py/completed/1077.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
if __name__ == "__main__":
|
||||
n, w = map(int, input().split())
|
||||
jewelries = [tuple(map(int, input().split())) for _ in range(n)]
|
||||
|
||||
dp = [0] * (w + 1)
|
||||
|
||||
for weight, price in jewelries:
|
||||
for j in range(weight, w + 1):
|
||||
dp[j] = max(dp[j], dp[j - weight] + price)
|
||||
|
||||
print(dp[w])
|
||||
Reference in New Issue
Block a user