Bone Collector(ZeroOnebag)
Bone Collector
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 ?
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.
total value (this number will be less than 231).
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
int T,V;
int v[],val[];
int f[];
int i,N,j;
cin>>T;
while(T--)
{
memset(f,,sizeof(f));
cin>>N>>V;
for(i=;i<=N;i++)
cin>>val[i];
for(i=;i<=N;i++)
cin>>v[i];
for(i=;i<=N;i++)
{
for(j=V;j>=v[i];j--)
f[j]=max(f[j],f[j-v[i]]+val[i]);
}
cout<<f[V]<<endl;
}
}
Bone Collector(ZeroOnebag)的更多相关文章
- hdu 2602 Bone Collector(01背包)模板
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 Bone Collector Time Limit: 2000/1000 MS (Java/Ot ...
- Bone Collector(01背包)
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87125#problem/N 题目: Description Many year ...
- 题解报告:hdu 2602 Bone Collector(01背包)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602 Problem Description Many years ago , in Teddy’s ...
- HDU 2602 Bone Collector (简单01背包)
Bone Collector http://acm.hdu.edu.cn/showproblem.php?pid=2602 Problem Description Many years ago , i ...
- 【01背包】HDU 2602 Bone Collector (模板题)
Problem Description Many years ago , in Teddy's hometown there was a man who was called "Bone C ...
- Hdu2602 Bone Collector (01背包)
Problem Description Many years ago , in Teddy’s hometown there was a man who was called “Bone Collec ...
- hdu2602 Bone Collector(01背包) 2016-05-24 15:37 57人阅读 评论(0) 收藏
Bone Collector Problem Description Many years ago , in Teddy's hometown there was a man who was call ...
- HDU 2602 Bone Collector(经典01背包问题)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2602 Bone Collector Time Limit: 2000/1000 MS (Java/O ...
- hdu 2602 - Bone Collector(01背包)解题报告
Bone Collector Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) T ...
随机推荐
- DataTables选择行并删除(删除单行)
$(document).ready(function() { var table = $('#example').DataTable(); $('#example tbody').on( 'click ...
- DSASync: Managing End-to-End Connections in Dynamic Spectrum Access Wireless LANs
其实跟上一篇是同一篇文章.不过上一篇是发表在IEEE Secon2010了,这篇是后来又增加了部分内容后的一版,收录在IEEE/ACM TRANSACTIONS ON NETWORKING, VOL. ...
- rsyslog VS syslog-ng,日志记录哪家强?
还有慢慢摸索,NG的MYSQL配置,我始终没搞好. RSYSLOG则比较容易. 另外,也可以每个RSYSLOG直接入库,不需要经过LOG SERVER..如果有一个大内网的话... 配合LOGANAL ...
- poj3294 --Life Forms
Life Forms Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 12483 Accepted: 3501 Descr ...
- Qt5+VS2013兼容XP方法
用Qt5+VS2013编译程序默认配置会在XP运行时报"不是有效的Win32程序"工作需要必须要XP运行 pro文件中加一句: 复制代码 QMAKE_LFLAGS_WINDOWS ...
- GBT28181中的RTP
国标中说h264数据按照RFC3984打包,但是国标的测试工具——SPVMN,却不支持RFC3984的打包方式.无奈之下直接用RFC3550的方式打包,其实就是分包,然后加上RTP头,对于一帧的结束, ...
- Android Studio代码着色插件
文章将给大家分享Studio中代码高亮插件,个人觉得换个代码着色方式还是挺有必要的,起码让视觉上有个变换,感官上爽一些.就像吃惯了大鱼大肉,偶尔也来点青菜萝卜吧.以下是个人喜欢的几款,给个效果图大家看 ...
- Hdu5785-Interesting(回文串处理)
Problem Description Alice get a string S. She thinks palindrome string is interesting. Now she wanna ...
- jdbc连接数据库工具类
import java.lang.reflect.Field; import java.sql.Connection; import java.sql.DriverManager; import ja ...
- Merlin 的魔力: SpringLayout 管理器
摘自http://tech.it168.com/a2009/0211/265/000000265087_all.shtml 摘自http://cache.baiducontent.com/c?m=9f ...