博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDoj 2602 Bone Collector 01背包
阅读量:6457 次
发布时间:2019-06-23

本文共 1136 字,大约阅读时间需要 3 分钟。

Problem Description

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.

Output

One integer per line representing the maximum of the total value (this number will be less than 2
31).

Sample Input

1
5 10
1 2 3 4 5
5 4 3 2 1

Sample Output

14
code:
#include
int a[1001]; int b[1001]; int f[1001]; int main() {
int n,t,k,v,i,j; scanf("%d",&t); for(k=0;k
=0;j--) {
if(f[j]
 

转载于:https://www.cnblogs.com/dream-wind/archive/2012/03/14/2395297.html

你可能感兴趣的文章
mysql的数据类型int、bigint、smallint 和 tinyint取值范围
查看>>
利用网易获取所有股票数据
查看>>
移动铁通宽带上网设置教程
查看>>
Python算法(含源代码下载)
查看>>
利用Windows自带的Certutil查看文件MD5
查看>>
通过原生js添加div和css
查看>>
简单的导出表格和将表格下载到桌面上。
查看>>
《ArcGIS Engine+C#实例开发教程》第一讲桌面GIS应用程序框架的建立
查看>>
JAVA - 大数类详解
查看>>
查询指定名称的文件
查看>>
Python 嵌套列表解析
查看>>
[GXOI/GZOI2019]旧词——树链剖分+线段树
查看>>
anroid 广播
查看>>
AJAX POST&跨域 解决方案 - CORS
查看>>
关于最小生成树中的kruskal算法中判断两个点是否在同一个连通分量的方法总结...
查看>>
开篇,博客的申请理由
查看>>
Servlet 技术全总结 (已完成,不定期增加内容)
查看>>
[JSOI2008]星球大战starwar BZOJ1015
查看>>
CountDownLatch与thread-join()的区别
查看>>
linux下MySQL安装登录及操作
查看>>