#K59962. Calculate Working Hours
Calculate Working Hours
Calculate Working Hours
You are given a number n representing the number of employees. For each employee, you are given their check-in and check-out times as four integers: Hin, Min, Hout, Mout.
Your task is to calculate the total working time for each employee. The total working minutes is computed as follows:
$$total\_work\_minutes = (H_{out} \times 60 + M_{out}) - (H_{in} \times 60 + M_{in})$$
Then, the hours and minutes worked are:
$$hours = \lfloor total\_work\_minutes/60 \rfloor$$
$$minutes = total\_work\_minutes \bmod 60$$
Output the results in the same order as input, printing each employee's working time on a separate line with the hour and minute separated by a space.
inputFormat
The first line contains an integer n
representing the number of employees. Each of the following n
lines contains four space-separated integers: H_in M_in H_out M_out
, representing the check-in hour, check-in minute, check-out hour, and check-out minute respectively.
outputFormat
For each employee, output a line with two space-separated integers representing the total hours and minutes worked.## sample
2
9 30 17 45
10 0 18 0
8 15
8 0
</p>