#C1996. Minimum Cars Required for Parcel Delivery
Minimum Cars Required for Parcel Delivery
Minimum Cars Required for Parcel Delivery
In this problem, you are given a number of test cases. For each test case, you are provided with an integer (N) representing the number of parcels and an integer (W) representing the maximum weight capacity of a car. You are also given a list of (N) integers where each integer denotes the weight of a parcel. Your task is to determine the minimum number of cars required to deliver all the parcels, such that the sum of the weights of the parcels in each car does not exceed (W).
Input Format: The first line contains an integer (T) representing the number of test cases. For each test case, the first line contains two space-separated integers (N) and (W). The next line contains (N) space-separated integers representing the weights of the parcels.
Output Format: For each test case, output a single integer on a new line which is the minimum number of cars required.
Note: It is guaranteed that each parcel must be loaded into some car even if its weight is greater than (W) (in such cases, that car will carry only that parcel).
inputFormat
The input is read from standard input (stdin). The first line contains an integer (T) denoting the number of test cases. For each test case, the first line contains two integers (N) (the number of parcels) and (W) (the maximum capacity of a car). The next line contains (N) integers representing the weights of the parcels.
outputFormat
For each test case, print the minimum number of cars required on a new line to standard output (stdout).## sample
2
5 10
2 3 8 5 6
4 15
10 10 10 10
3
4
</p>