#K60352. Maximum Consecutive Days for Watering Crops
Maximum Consecutive Days for Watering Crops
Maximum Consecutive Days for Watering Crops
Alice has a set of crops that require watering every day. Each crop has a specific water requirement. Given the total daily water supply \(W\) and the water requirements of \(N\) crops, your task is to determine the maximum number of consecutive days that Alice can water all the crops such that the water supply is sufficient.
For each test case, if the sum of water requirements of all crops is greater than \(W\), then Alice cannot water all the crops even for a single day, and the answer is 0. Otherwise, the number of days is given by \(\left\lfloor \frac{W}{\sum_{i=1}^{N} water\_requirement_i} \right\rfloor\).
Input/Output: The problem takes multiple test cases from standard input and produces the corresponding results on standard output.
inputFormat
The first line of input contains an integer \(T\) representing the number of test cases. Each test case consists of two lines:
- The first line contains two integers \(N\) and \(W\), where \(N\) is the number of crops and \(W\) is the total daily water supply.
- The second line contains \(N\) integers, representing the water requirements for each crop.
All input should be read from standard input.
outputFormat
For each test case, output the maximum number of consecutive days Alice can water all the crops. Each result should be printed on a new line to standard output.
## sample3
5 100
15 20 10 30 25
4 50
10 20 30 40
3 300
100 100 100
1
0
1
</p>