#K2346. ATM Transaction Processing
ATM Transaction Processing
ATM Transaction Processing
In this problem, you are given multiple test cases, each representing a series of ATM transactions and a cash limit for the ATM. For each test case, determine the maximum number of consecutive transactions that can be processed without exceeding the ATM's cash limit. Transactions must be processed in order, and once a transaction would cause the cumulative sum to exceed the limit, no further transactions are processed. Formally, if the ATM limit is denoted by and the transactions are , then you must find the maximum integer (starting from 0) such that $$\sum_{i=1}^{k}a_i\leq l.$$
inputFormat
The input begins with a single integer () on a new line representing the number of test cases. For each test case, the first line contains two integers and , where is the number of transactions and is the ATM's cash limit. The following line contains space-separated integers representing the transaction amounts.
outputFormat
For each test case, output a single integer on a separate line representing the maximum number of consecutive transactions that can be processed without exceeding the ATM's cash limit.## sample
1
5 100
20 30 50 10 5
3