Cuckoo! Cuckoo!
Time limit1sMemory limit1024 MB
Given a 12-hour clock time and a count N, find the clock time at which the cuckoo has sounded N times in total.
- Level
Easy2 of 10
- Topics
- Implementation, Simulation
- Solved
- No attempts yet
Problem
A cuckoo bird pops out of the cuckoo clock and sounds off once at each quarter hour, half hour, and three-quarter hour. At the start of each hour, it sounds off as many times as the hour, from 1 to 12. Given the current time and a target number , find the time when the cuckoo has sounded off times. Sounds at the starting time count toward the total.
If the count is reached on the hour, report the time at the start of that hour. You may assume the cuckoo finishes sounding off before the minute is up.
Input
The first line contains the current time in the form HH:MM, where 1 HH 12 and 0 MM 59, with leading zeros if necessary. The second line contains a single integer , where 1 200.
Output
Print the time when the cuckoo has sounded off times, in the same format as the input.