#K95742. Maximum Production Calculation
Maximum Production Calculation
Maximum Production Calculation
You are given a production schedule for one or more shifts. For each shift, the production facility has several machines. The first line of each test case contains two integers \(M\) and \(T\), where \(M\) is the number of machines available during this shift and \(T\) is the total available time (in minutes). The following \(M\) lines each contain two integers \(p\) and \(t\), representing the production rate (items per cycle) and the cycle time (in minutes) for that machine, respectively.
Your task is to compute the total number of items produced during the shift. For each machine, the number of production cycles that can be completed is \(\lfloor \frac{T}{t} \rfloor\), and the total items produced by that machine is \(p \times \lfloor \frac{T}{t} \rfloor\). The answer for a shift is the sum of items produced by all machines.
Note: All input should be read from standard input, and all output should be written to standard output.
inputFormat
The first line of input contains an integer \(N\), indicating the number of test cases. The description for each test case is as follows:
- The first line contains two space-separated integers: \(M\) (the number of machines) and \(T\) (the total shift time in minutes).
- The next \(M\) lines each contain two space-separated integers, \(p\) and \(t\), where \(p\) is the production rate and \(t\) is the cycle time (in minutes) for that machine.
It is guaranteed that \(t > 0\) for all machines.
outputFormat
For each test case, output a single line containing one integer: the total number of items produced in that shift.
## sample3
3 30
5 1
3 2
2 5
2 60
7 3
2 5
1 10
6 2
207
164
30
</p>