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 ...
随机推荐
- 第二、UIScrollView的使用大全
UIScrollView UIPageControl 的使用 2011-11-19 16:48 4690人阅读 评论(0) 收藏 举报 imagescrollspringiphone // // ...
- [UVA] 784 - Maze Exploration
Maze Exploration A maze of rectangular rooms is represented on a two dimensional grid as illustra ...
- My Eclipse 自动提示
1.My Eclipse 自带代码提示快捷键 “ alt+/”. 2.输入即提示:window-->preferences-->java-->Editor 展开后点击Content ...
- Win7+CentOS双系统,最清晰细致的教程!
Win7的系统下安装CentOS,实现双系统切换使用的目的,希望对大家有帮助. 注意: 1.由于涉及到对硬盘操作,请妥善备份数据,避免损失. 2.我的步骤是绝对正确和缺一不可的,大家一定要按照我的操作 ...
- position 为absolute时/float 为right,span为block
元素分为内联元素和区块元素两类(当然也有其它的),在内联元素中有个非常重要的常识,即内两元素是不可以设置区块元素所具有的样式,例如:width | height.relative : 原来是什么类型的 ...
- Digit Stack
Digit Stack In computer science, a stack is a particular kind of data type or collection in which th ...
- java设计模式--创建型模式--抽象工厂
什么是抽象工厂,再次学习. 抽象工厂 概述 提供一个创建一系列相关或相互依赖对象的接口,而无需指定它们具体的类. 适用性 1.一个系统要独立于它的产品的创建.组合和表示时. 2.一个系统要由多个产品系 ...
- hihoCoder 1098
题目大意:n 个城市由 m 条边连接,每条边有权值,求将所有城市连接起来时的最小权值和. 代码: #include<iostream> #include<cstdio> #in ...
- mysql 基础技术
一.树状结构 参考http://www.cnblogs.com/kingteach/archive/2011/07/05/2098046.html )) begin declare lev int; ...
- 从 mysql 客户端导出数据库 mysqldump
window+r 打开cmd 输入 mysqldump -u mysql用户名 -p 数据库名 > 要导出的位置 (注意,最后没有分号) 然后输入密码即可 ^_^