#CCBCHMUOI0000004. Đồng hồ cộng phút (Clock After Adding Minutes)
Đồng hồ cộng phút (Clock After Adding Minutes)
Clock After Adding Minutes
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
A 24-hour clock currently shows hour h and minute m. After k minutes, find the new hour and minute. The clock wraps from 23:59 to 00:00. Print two integers separated by one space; no colon or leading zeros are required.
Input
One line contains integers h, m and k: current hour, current minute and minutes to add.
Output
Print the new hour and minute as two space-separated integers, in that order.
Subtasks
- Subtask 1 (20%): 0 <= h < 24, 0 <= m < 60 and 0 <= k <= 59.
- Subtask 2 (30%): 0 <= h < 24, 0 <= m < 60 and 0 <= k <= 1439.
- Subtask 3 (50%): 0 <= h < 24, 0 <= m < 60 and 0 <= k <= 10^9.
Examples
Example 1
Input
23 58 5
Output
0 3
Explanation
23:58 is minute 1438. Adding 5 gives 1443; mod 1440 is 3, i.e. 0:03.
Example 2
Input
12 34 1440
Output
12 34
Explanation
1440 minutes is one full day, leaving the time unchanged.
Example 3
Input
0 0 1000000000
Output
10 40
Explanation
One billion minutes leaves 640 minutes modulo 1440, namely 10:40.