#K50237. Calculate Total Hours and Overtime
Calculate Total Hours and Overtime
Calculate Total Hours and Overtime
In this problem, you are given the number of employees and the number of hours each employee worked over a week (7 days). Your task is to calculate the total number of hours worked and the overtime hours for each employee. An employee's overtime hours are computed as:
\( overtime = \max(0, total\_hours - 40) \)
For each employee, sum all daily hours to obtain the total hours. If an employee worked more than 40 hours, the extra hours are counted as overtime; otherwise, the overtime is 0.
The input will be provided via standard input (stdin) and the output should be printed to standard output (stdout).
inputFormat
The first line contains an integer N representing the number of employees. The following N lines each contain 7 space-separated integers, each representing the hours worked by an employee for each day of the week.
Example:
3
8 8 8 8 8 0 0
10 10 10 10 10 0 0
5 5 5 5 5 5 5
outputFormat
For each employee, output two numbers separated by a space on a new line. The first number is the total hours worked during the week, and the second number is the overtime hours (if any).
Example:
40 0
50 10
35 0
3
8 8 8 8 8 0 0
10 10 10 10 10 0 0
5 5 5 5 5 5 5
40 0
50 10
35 0
</p>