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.
每个杯子里的东西重量都不同,这样,从理论上看,这些杯子的重量都不同。
As I mentioned before, fat has twice the calories per unit weight as protein and carbohydrate.
如我之前所说,单位重量中脂肪的热量含量,是蛋白质和碳水化合物的两倍
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.
他们付你钱,那时我们有许多有名的,重量级的客户,但突然间,客户变成了对手,这么做风险很大。
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.
这是剩下的重量。
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的简写。
应用推荐