This is AtCoder's Knapsack 1 (DP D). You have n items with weights and values. Find the maximum value you can carry in a knapsack of capacity W.
You've already learned this pattern with 0/1 Knapsack. The state is dp[i][w] = max value using first i items with capacity w. The transition: take or skip each item. Apply what you learned. Watch out for the constraints: n ≤ 100, W ≤ 105. Standard 0/1 knapsack works perfectly here.