-->
当前位置:首页 > 题库

PROGRAMMING:01 Backpack

Luz5年前 (2021-05-10)题库387
The thing is, JZK is going to climb the mountain, but his bag capacity is limited, but he needs a lot of energy, otherwise he is easy to be hungry.
The first line shows how many times JZK is going to climb the mountain.
Every time I climb the mountain, I will bring new bags (because JZK will be robbed by ZWG for every bag I use), and prepare new food (because ZWG will eat the rest every time).
The next line gives you the number of food n, and the backpack capacity K,
The next line gives the energy of N foods, and the next line gives the size of N foods (in the capacity of the backpack).
Please help JZK calculate how much energy food he can take to climb the mountain. Output the maximum energy and energy that can carry food.
(n, m < 1000) energy and food were less than 40000
###Input format:
The first line contains the integer T, indicating that there are t groups of cases.
The first line contains two integers n, m, (n < = 1000, m < = 1000), indicating the number of items and the volume of the bag. The second line contains n integers representing the energy of each item. The third line contains n integers representing the volume of each item.
###Output format:
Each group of cases has one line, and only one number is output, indicating the maximum energy that JZK can obtain.
###Input example:
Here is a set of inputs. For example:
```in
one
5 10
1 2 3 4 5
5 4 3 2 1
```
###Output example:
The corresponding output is given here. For example:
```out
fourteen
```
### TIPS:
(bag capacity is 10) can take the second, third, fourth, fifth food, 2 + 3 + 4 + 5 = 14







answer:If there is no answer, please comment