# 题目

## 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

## 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 231).

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

14

# 翻译

## 描述

“集骨者”会收集各种各样的骨头,狗、牛……他甚至会进入坟墓来获取骨头
“集骨者”有一个容量为 `V` 的背包,显然在他的旅行中,这就是他放骨头的地方

# 代码

```/*
By:OhYee
Github:OhYee
Blog:http://www.oyohyee.com/
Email:oyohyee@oyohyee.com

かしこいかわいい？
エリーチカ！

*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <iostream>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <functional>
using namespace std;

const int maxn = 1005;

int v,n;
int dp[maxn];
int value[maxn];
int vol[maxn];

void ZeroOnePack(int cost,int weight) {
for(int i = v; i >= cost; i--)
dp[i] = max(dp[i],dp[i - cost] + weight);
}

void Do() {
scanf("%d%d",&n,&v);

for(int i = 1;i <= n;i++)
scanf("%d",&value[i]);
for(int i = 1;i <= n;i++)
scanf("%d",&vol[i]);
memset(dp,0,sizeof(dp));
for(int i = 1;i <= n;i++)
ZeroOnePack(vol[i],value[i]);

printf("%d\n",dp[v]);

}

int main() {
int T;
scanf("%d",&T);
while(T--)
Do();
return 0;
}
```