And so you could construct all subsets, check that the weight is less than the weight of the knapsack, and then choose the subset with the maximum value.
因此你可以构建所有子问题,判断它的重量,是否小于背包的重量,然后选择值最大的子问题。
Then if the weight of i is less than the available weight, I can return the value of i.
然后如果i的重量,小于剩下的重量,我将返回i的价值。
And inside of each of these cups is a different weight so that in theory all of these cups are different weights.
每个杯子里的东西重量都不同,这样,从理论上看,这些杯子的重量都不同。
Fat has twice the calories per unit weight that protein or carbohydrate sugar has, as a consequence, has the greatest survival value.
单位重量中脂肪的热量含量,是蛋白质和碳水化合物的两倍,因此,脂肪才是最能维持生存的物质
Each weighing, say, one 100th of the weight 1/100 needed to establish p external is equal to p1.
每颗重,比方说,使外压强,达到p1的重量的。
They pay you money, we had a lot of very famous, very prominent customers, but all of a sudden, we started to compete with every one of them. It's quite risky.
他们付你钱,那时我们有许多有名的,重量级的客户,但突然间,客户变成了对手,这么做风险很大。
It was a tragic--It was crushed by the weights of the electrodes.
是个悲剧,被电极的重量给压死了
He has on top of his head a helmet made of bronze, perhaps weighing about five pounds, these are approximate; they would have differed from person to person to some degree.
他的头部有铜质头盔,头盔大概重五磅,这只是大概的重量,实际重量因人而异
So at the end of the day we're not gonna get out of this need to compare, at least in this context of cups that have weights or ints that have values.
最终我们也无法改变要进行比较的需要,至少在有重量的杯子或者,整数的情况下是这样的。
So all you have behind here for spaces sake is just 8 cups, each with different weights.
在天平后面就是8个杯子,它们的重量互不相同。
And now we want to find the subset of a that has the maximum value, subject to the weight constraint.
会有一个值与其对应,现在我们想要找出满足,重量约束条件的a的最大值子集。
As I mentioned before, fat has twice the calories per unit weight as protein and carbohydrate.
如我之前所说,单位重量中脂肪的热量含量,是蛋白质和碳水化合物的两倍
The next line says if the weight of i is greater than a w, well then I know I can't put it in.
下一行说的是,如果i的重量比a,w大,好吧,我知道我不能把它放进去。
Of the weights and the values.
代表的是重量和价值。
This is the weight still available.
这是剩下的重量。
So each of these cups again have different weights if I want to find the lightest of them I might start not knowing which is which.
它们的重量互不相同,如果我要,找出最轻的一个,而我根本不知道会是,哪一个。
v The weight, w, and v, these are the two vectors we've seen here.
重量是w和价值,这是我们看过的向量的两个值。
a w And the amount of weight available, a w, for available weight.
合适的重量的个数是,也就是available,weight的简写。
And so the value of with i will be the value of i plus whatever I can get using the remaining items and decrementing the weight by the weight of i.
所以装上i之后的总价值,就是i的价值加上剩下物品中,符合条件者的所有价值,再在剩余重量中减去i的重量。
应用推荐