F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Clarke and food

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 2088    Accepted Submission(s): 1007


Problem Description
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.
 

Input
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)$.
 

Output
For each test case, print a line with an integer which denotes the answer.
 

Sample Input
1 3 5 1 3 4
 

Sample Output
2 Hint: We can carry 1 and 3, the total volume of them is 5.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-20 06:25:38, Gzip enabled