Type: Default 1000ms 256MiB

背包问题(一)F902

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

经典的 0-1 背包:知道 n 个物品的体积和价值,第 i 个体积为 V[i],价值为 W[i],有一个背包的容积为 C。求在体积不超容积的前提下,背包中可装物品价值的最大值。

Input Format

第一行:两个整数 n 和 C ;

第 2 行到第 n+1 行:每行两个整数 Vi 与 Wi,有一个空格分隔。

Output Format

一个数,表示背包中能得到物品价值的最大值。

2 10
1 1
2 2
3

Hint

数据范围:输入的数据均不超过20,搜索或dp。