#K2721. Calculation of Weekday Work Hours
Calculation of Weekday Work Hours
Calculation of Weekday Work Hours
You are given a list of work logs for various employees. Each work log consists of an employee ID, a start time and an end time, both in ISO 8601 format. Your task is to calculate the total number of hours each employee has worked during weekdays (i.e. Monday through Friday). Note that if a work period spans multiple days, you have to break it into segments by midnight boundaries. For each segment falling on a weekday, add the duration in hours to the employee's total.
The conversion of seconds to hours is performed using the formula:
$$\text{hours} = \frac{\text{total seconds}}{3600}$$
Note: Weekends (Saturday and Sunday) should not be counted toward the total hours.
inputFormat
The first line of input contains an integer n
(the number of work logs). Each of the next n
lines contains a work log in the following format:
employee_id start_time end_time
Here, start_time
and end_time
are in ISO 8601 format (e.g., 2023-10-11T08:00:00
).
outputFormat
For each employee, output a line containing the employee ID and the total weekday work hours (rounded to one decimal place), separated by a space. The employees should be listed in lexicographical order of their IDs.
## sample1
emp1 2023-10-11T08:00:00 2023-10-11T17:00:00
emp1 9.0