#K54497. Calculate Employee Presence Minutes

    ID: 29766 Type: Default 1000ms 256MiB

Calculate Employee Presence Minutes

Calculate Employee Presence Minutes

An employee attendance system records the check-in and check-out times during a day. Each test case contains a list of timestamps in 24-hour format (HH:MM) where every two consecutive timestamps represent a check-in and its corresponding check-out.

Your task is to compute the total number of minutes the employee was present for each test case.

The difference between two timestamps is calculated as follows:

\(\text{minutes} = (h_2 - h_1) \times 60 + (m_2 - m_1)\)

For example, the time interval from 09:00 to 12:00 yields \(180\) minutes.

inputFormat

The input is read from standard input (stdin) and has the following format:

  • The first line contains an integer \(T\), the number of test cases.
  • For each test case, there are two lines:
    • The first line contains an even integer \(N\) (the number of timestamps).
    • The second line contains \(N\) timestamps in HH:MM format separated by spaces. Each consecutive pair represents a check-in and a check-out time.

outputFormat

For each test case, print a single line containing a single integer, which is the total number of minutes the employee was present throughout that day. The output should be written to standard output (stdout).

## sample
3
4
09:00 12:00 13:00 17:00
6
08:30 12:45 14:15 15:30 16:00 18:00
4
07:00 09:30 10:00 12:15
420

450 285

</p>