← 回題庫

卷別

資料結構與演算法

選擇

國立中興大學 2025 · 考試 · 第 8 題

考科演算法

(3 points) Consider the following array of positive integers representing the value of items: values =[10,4,3,7,6]= [10, 4, 3, 7, 6], and their corresponding weights: weights =[5,2,1,3,4]= [5, 2, 1, 3, 4]. You are given a knapsack with a maximum capacity of 9 units. Using dynamic programming, calculate the maximum total value you can achieve by selecting items such that their total weight does not exceed the capacity.

  • (A)
    19
  • (B)
    20
  • (C)
    21
  • (D)
    23

標準解析

AI 已複查