#C6129. Race Time and Final Speed Increment Lap
Race Time and Final Speed Increment Lap
Race Time and Final Speed Increment Lap
You are given a race which consists of n laps. Each lap takes a constant time t to complete. In the race, the speed is increased every m laps. Your task is to calculate two things for each race:
- The total race time, which is computed as \(n \times t\).
- The lap number at which the speed was incremented for the last time. This is given by \(\lfloor \frac{n}{m} \rfloor \times m\). If no speed increment occurs (i.e. when \(n < m\)), output 0 for the lap number.
It is guaranteed that all inputs are integers. Read input from standard input and write your output to standard output.
inputFormat
The input starts with an integer (T) (the number of test cases). Each of the following (T) lines contains three space-separated integers (n), (t), and (m), where (n) is the number of laps, (t) is the time per lap, and (m) indicates that the speed increases every (m) laps.
outputFormat
For each test case, output a line containing two space-separated integers: the total race time (i.e., (n \times t)) and the lap number at which the speed was incremented for the last time (i.e., (\lfloor\frac{n}{m}\rfloor \times m)).## sample
1
12 10 4
120 12
</p>