HDU 2602 Bone Collector 之01背包
来源:互联网 发布:java实现一个迭代器 编辑:程序博客网 时间:2024/06/12 23:58
Description
Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave …
The bone collector had a big bag with a volume of V ,and along his trip of collecting there are a lot of bones , obviously , different bone has different value and different volume, now given the each bone’s value along his trip , can you calculate out the maximum of the total value the bone collector can get ?
The bone collector had a big bag with a volume of V ,and along his trip of collecting there are a lot of bones , obviously , different bone has different value and different volume, now given the each bone’s value along his trip , can you calculate out the maximum of the total value the bone collector can get ?
Input
The first line contain a integer T , the number of cases.
Followed by T cases , each case three lines , the first line contain two integer N , V, (N <= 1000 , V <= 1000 )representing the number of bones and the volume of his bag. And the second line contain N integers representing the value of each bone. The third line contain N integers representing the volume of each bone.
Followed by T cases , each case three lines , the first line contain two integer N , V, (N <= 1000 , V <= 1000 )representing the number of bones and the volume of his bag. And the second line contain N integers representing the value of each bone. The third line contain N integers representing the volume of each bone.
Output
One integer per line representing the maximum of the total value (this number will be less than 2 31).
Sample Input
15 101 2 3 4 55 4 3 2 1
Sample Output
14
分析:这是最基础的01背包,其原理我就不说了,百度上面都有,可以看看背包9讲。
其实,只要搞清楚边界问题就好。
代码如下:
0 0
- HDU 2602 Bone Collector 之01背包
- 01背包问题之HDU——2602 Bone Collector
- hdu 2602 (01 背包)Bone Collector
- hdu 2602 Bone Collector 01背包
- hdu 2602 Bone Collector 01背包
- hdu 2602 Bone Collector (01背包)
- hdu 2602 Bone Collector【01背包】
- hdu 2602 Bone Collector 简单01背包
- hdu 2602 Bone Collector(01背包)
- hdu 2602 Bone Collector (01背包)
- HDU 2602 Bone Collector(裸01背包)
- HDU 2602 Bone Collector( 01背包 )
- HDU 2602 Bone Collector(01背包)
- hdu 2602 Bone Collector 01背包
- HDU 2602 Bone collector 01背包
- hdu 2602 Bone Collector (01背包 )
- hdu 2602 Bone Collector (01背包)
- HDU 2602 Bone Collector (01背包)
- 利用pktgen发包工具做性能测试
- Android4.0 Launcher拖拽原理分析(一)
- Log4j配置
- Objective-C中的instancetype和id区别
- go语言设计哲学
- HDU 2602 Bone Collector 之01背包
- hdu 1849 nim游戏
- 常用网址总结
- iOS应用内支付(IAP)的注意事项
- poj 2104 -- kth number 平方分割法例题
- Jar mismatch! Fix your dependencies
- IE 浏览器 安装证书 无响应 卡死
- 面向企业级应用开发的综合性、高效能的HTML5电子表格控件——SpreadJs
- hibernate的查询方式