#P2871. [USACO07DEC] Charm Bracelet S
[USACO07DEC] Charm Bracelet S
Description
Bessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from the available charms. Each charm i in the supplied list has a weight , a 'desirability' factor , and can be used at most once. Bessie can only support a charm bracelet whose weight is no more than .
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.
Input Format
-
Line : Two space-separated integers: and .
-
Lines : Line describes charm with two space-separated integers: and .
Output Format
- Line : 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
23
京公网安备 11011102002149号