2585. 0-1 Package

单点时限: 2.0 sec

内存限制: 256 MB

Partychen has gone to the mall’s jewelry store and spies a charm bracelet. Of course, he’d like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm i in the supplied list has a weight Wi (1 ≤ Wi ≤ 400), a ‘desirability’ factor Di (1 ≤ Di ≤ 100), and can be used at most once. partychen can only support a charm bracelet whose weight is no more than M (1 ≤ M ≤ 12,880).

Given that weight limit as a constraint and a list of the charms with their weights and desirability rating, deduce the maximum possible sum of ratings.


The first line are two space-separated integers: N and M

The next N lines describes charm i with two space-separated integers: Wi and Di


A single integer that is the greatest sum of charm desirabilities that can be achieved given the weight constraints


4 6
1 4
2 6
3 12
2 7
We choose 1 4,2 7,3 12,we can get the greatest sum 23.and the weight is 6.

123 人解决,164 人已尝试。

156 份提交通过,共有 446 份提交。

3.3 EMB 奖励。

创建: 13 年,4 月前.

修改: 3 年,7 月前.

最后提交: 3 周,5 天前.

来源: partychen