#C4482. Marathon Runner Time Calculation
Marathon Runner Time Calculation
Marathon Runner Time Calculation
In this problem, you are required to compute the time difference in seconds between the start and finish times for multiple runners in a marathon. Each time is given in the format HH:MM:SS
. Note that if the finish time is earlier than the start time, it is assumed that the finish time refers to the next day.
You need to process multiple test cases. For each test case, the first line contains the number of runners, followed by one line per runner containing two time strings. The answer for each runner is the total running time in seconds computed by the formula:
$$ \text{Difference} = (\text{finish seconds} - \text{start seconds} + 86400)\ \%\ 86400 $$
The results for all runners in each test case should be printed, one per line, to stdout
.
inputFormat
The input is read from stdin
and has the following format:
- The first line contains a single integer T denoting the number of test cases.
- For each test case:
- The first line contains an integer N denoting the number of runners.
- Each of the next N lines contains two time strings (start and finish) in the format
HH:MM:SS
.
outputFormat
For each test case, print the time difference in seconds for each runner, one per line. The output is written to stdout
.
3
3
08:00:00 11:00:00
07:30:00 10:45:00
09:15:00 12:45:00
1
00:00:00 00:00:00
2
23:59:59 00:00:00
00:00:00 23:59:59
10800
11700
12600
0
1
86399
</p>