hdoj2602

7975 단어 OJ
Problem : 2602 ( Bone Collector )     Judge Status : Accepted RunId : 2593371    Language : G++    Author : huwenbiao Code Render Status : Rendered By HDOJ G++ Code Render Version 0.01 Beta
/***************************************************************\
*Author:
*Created Time: Mon 12 Jul 2010 04:06:35 PM CST
*File Name: main.cpp
*Description: 01
\***************************************************************/

//*========================*Head File*========================*\\

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
/*----------------------*Global Variable*----------------------*/
//Val Vol ,bag ,
int T,N,V,Val[1001],Vol[1001],bag[1001];
//*=======================*Main Program*=======================*//
using namespace std;

int
main(){
scanf(
"%d",&T);
while
(T--){
memset(bag,
0,sizeof(bag));
scanf(
"%d%d",&N,&V);
for
(int i=
1;i<=N;++i)
scanf(
"%d",Val+i);
for
(int i=
1;i<=N;++i)
scanf(
"%d",Vol+i);
for
(int i=
1;i<=N;++i)
for
(int v=V;v>=Vol[i];--v)
bag[v]=max(bag[v],bag[v-Vol[i]]+Val[i]);
printf(
"%d
"
,bag[V]);
}

return
0;
}

좋은 웹페이지 즐겨찾기