#C10045. Maximum Number of Sessions
Maximum Number of Sessions
Maximum Number of Sessions
Problem Description:
You are given a number of test cases. For each test case, you are provided with two integers: , the number of sessions, and , the total available hours. In addition, you are given a list of session durations. Your task is to determine the maximum number of sessions that can be scheduled such that the sum of the durations does not exceed .
The optimal strategy is to select the sessions with the shortest durations first. This ensures that you can fit as many sessions as possible within the given time constraint.
inputFormat
Input Format:
The first line of input contains an integer , the number of test cases. Each test case consists of two lines:
1. The first line contains two space-separated integers: (the number of sessions) and (the available hours).
2. The second line contains space-separated integers representing the durations of the sessions.
outputFormat
Output Format:
For each test case, print a single integer representing the maximum number of sessions that can be scheduled without exceeding the available hours. Each result should be printed on a new line.## sample
2
5 15
2 3 5 8 1
3 8
4 2 6
4
2
</p>