12694 - 電機資結 2020 HW0 Steal the most Value
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
| Case 6 |
1 sec |
32 MB |
| Case 7 |
1 sec |
32 MB |
| Case 8 |
1 sec |
32 MB |
| Case 9 |
1 sec |
32 MB |
| Case 10 |
1 sec |
32 MB |
Description
■ You are a thief sneaking into a house that contain N-items with a bag that can hold K-kilograms.
■ Each item contains its own value(Vi) and weight(Wi).
■ Since your bag is not strong enough to carry over the limit of K(the sum of weight W you carry must be less than K).
■ What is the highest value you can carry out from this house?
Input
■ The first line contains two integers N(the number of items in the house) and K(how much can the bag hold).
■ Each of the following N lines contains two integers Vi and Wi, which describe the value and weight of i-th item, respectively
Output
■ Print the most value the thief can get.
■ P.S. You don’t need to print newline in the end!
Tags