原文:
描述
Given the weights and values of N items, put a subset of items into a knapsack of capacity C to get the maximum total value in the knapsack. The total weight of items in the knapsack does not exceed C.
输入
First line: two positive integers N (N <= 100) and C (C <= 1000).
Second line: N positive integers w[i] (w[i] <= 1000), indicating the weight of the i-th item.
Third line: N positive integers v[i] (v[i] <= 1000), indicating the value of the i-th item.
输出
One line contains several integers, indicating the indexes of the selected items.
翻译:
描述:
给出n个物品的重量和价值,放入容量为c背包中,要使总价值最大,且重量之和不能超过c。
输入:
第一行:N和C,N表示N个物品,C表示容量
第二行:N个正整数W,第i项表达第i个物品的重量
第三行:N个正整数V,第i项表达第i个物品的价值
输出:
一行数列,表示哪几项放进背包