AT_abc479_c.Bento Packing
普及-
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There are N side dishes.
The i-th side dish has a deliciousness of Ai and a volume of Bi.
You will choose some of the side dishes so that the total volume of the chosen dishes is at most W, and pack them into a lunch box.
Find the maximum possible total deliciousness of the chosen side dishes.
共有 N 道配菜。
第 i 道配菜的美味度为 Ai,体积为 Bi。
你需要从中选择若干道配菜,使得所选配菜的总体积不超过 W,并将它们装入一个便当盒中。
求所选配菜的最大可能总美味度。
输入格式
The input is given from Standard Input in the following format:
N W
A1 B1
A2 B2
⋮
AN BN
输入从标准输入中按以下格式给出:
N W
A1 B1
A2 B2
⋮
AN BN
输出格式
Output the answer.
输出答案。
输入输出样例
输入#1
4 13 4 5 3 3 5 9 8 6
输出#1
12
输入#2
3 99 1 100 10 100 100 100
输出#2
0
输入#3
5 9 6 4 9 1 2 1 4 3 5 4
输出#3
21
说明/提示
Sample 1 Explanation:
If you pack the 1-st and 4-th side dishes into the lunch box, the total deliciousness is 12 and the total volume is 11.
Sample 2 Explanation:
You may also pack no side dishes.
Constraints
- 1≤N≤20
- 1≤W≤109
- 1≤Ai,Bi≤109
- All input values are integers.
样例 1 解释:
若将第 1 个和第 4 个配菜装入便当盒,则总美味度为 12,总体积为 11。
样例 2 解释:
你也可以不装入任何配菜。
约束条件
- 1≤N≤20
- 1≤W≤109
- 1≤Ai,Bi≤109
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?