#Z01536. 多重背包 II

多重背包 II

题目描述

有 Nlns="http://www.w3.org/1998/Math/MathML">� 种物品和一个容量是 Vlns="http://www.w3.org/1998/Math/MathML">� 的背包。

第 ilns="http://www.w3.org/1998/Math/MathML">� 种物品最多有 silns="http://www.w3.org/1998/Math/MathML">�� 件,每件体积是 vilns="http://www.w3.org/1998/Math/MathML">��,价值是 wilns="http://www.w3.org/1998/Math/MathML">��。


求解将哪些物品装入背包,可使物品体积总和不超过背包容量,且价值总和最大。

输出最大价值。

输入格式

第一行两个整数,N,Vlns="http://www.w3.org/1998/Math/MathML">�,�,用空格隔开,分别表示物品种数和背包容积。

接下来有 Nlns="http://www.w3.org/1998/Math/MathML">� 行,每行三个整数 vi,wi,silns="http://www.w3.org/1998/Math/MathML">��,��,��,用空格隔开,分别表示第 ilns="http://www.w3.org/1998/Math/MathML">� 种物品的体积、价值和数量。


0

0 0

输出格式

输出一个整数,表示最大价值。

4 5
1 2 3
2 4 1
3 4 3
4 5 2
10