POJ3624解题报告
来源:互联网 发布:淘宝信息管理系统 编辑:程序博客网 时间:2024/06/10 17:10
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 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. Bessie 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.
Input
* Line 1: Two space-separated integers: N and M
* Lines 2..N+1: Line i+1 describes charm i with two space-separated integers: Wi and Di
Output
* Line 1: A single integer that is the greatest sum of charm desirabilities that can be achieved given the weight constraints
Sample Input
4 61 42 63 122 7
Sample Output
23
题意:给定每个物品的重量和价值,求给定最大重量下能获得的最大价值。。
我的背包第一题
思路:01背包,状态方程为dp[i][j]=MAX(dp[i-1][j],dp[i-1][j-weight[i]]+value[i])
- POJ3624解题报告
- 0 1背包解题报告 poj3624
- POJ3624
- poj3624
- poj3624
- poj3624
- poj3624
- poj3624
- poj3624
- POJ3624
- poj3624
- poj3624
- poj3624
- POJ3624
- poj3624
- poj3624
- poj3624
- 解题报告
- FreeMarker的怎么对空值的处理
- 内存泄漏检测工具.和一些内存管理建议
- 股票操作记录 2010.12.27
- sql查询
- 人民币存款利率表2010-12-26
- POJ3624解题报告
- xxx.equals(null),xxx==null
- Flex读取配置文件(转载)
- 教你在VMWare下安装MAC OS X Snow Leopard 10.6
- Activity 生命周期
- HttpClient学习
- ISO8583协议(转载)
- Apache Roller安装与配置
- JavaScript 获取浏览器的页面编码和支持语言