P19767 [GeeksforGeeks] Time to words3728
普及-
题目描述

Given a time in the format of hh:mm (12-hour format) 0 < HH < 12, 0 <= MM < 60. The task is to convert it into words.
Note: There are different corner cases appears for simplicity refer this example:
6:00 six o'clock
6:10 ten minutes past six
6:15 quarter past six
6:30 half past six
6:45 quarter to seven
6:47 thirteen minutes to seven
Example 1:
Input: H = 6, M = 0
Output: six o' clock
Explanation: 6H:0M = six o' clock.
Example 2:
Input: N = 6, M = 10
Output: ten minutes past six
Explanation: 6H:10M = ten minutes past six.
Your Task:
You dont need to read input or print anything. Complete the function timeToWord() which takes H and M as input parameter and returns words converted from given time.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(k^{2})
Constraints:
0 < H < 12
0= < M < 60

输入格式

见题面

输出格式

见题面

样例输入
H = 6, M = 0
样例输出
six o' clock