当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5562:Clarke and food

题目描述
Clarke is a patient with multiple personality disorder. One day, Clarke turned into a cook, was shopping for food.
Clarke has bought $n$ food. The volume of the $i$th food is $v_i$. Now Clarke has a pack with volume $V$. He wants to carry food as much as possible. Tell him the maxmium number he can brought with this pack.
输入解释
The first line contains an integer $T(1 \le T \le 10)$, the number of the test cases.
For each test case:
The first line contains two integers $n, V(1 \le n \le 10^5, 1 \le V \le 10^9)$.
The second line contains $n$ integers, the $i$th integer denotes $v_i(1 \le v_i \le 10^9)$.
输出解释
For each test case, print a line with an integer which denotes the answer.
输入样例
1
3 5
1 3 4
输出样例
2

Hint:  
We can carry 1 and 3, the total volume of them is 5.  
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5562

最后修改于 2020-10-25T23:23:47+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)