When Do We Finish?
InterviewTime limit1sMemory limit128 MB
Add each event's duration to its start time and print the resulting clock time, appending the number of days past midnight when the end crosses into later days.
- Level
Easy3 of 10
- Topics
- Math, Implementation, Simulation, Brute force
- Solved
- No attempts yet
Problem
You are given the starting time of an event and its duration. Determine the time at which the event ends.
Input
The input consists of several lines, each representing one event. The last line is 00:00 00:00 and must not be processed.
Each line contains two times separated by a space, both in hh:mm format. The first time is the event's start time, given as a valid 24-hour clock time. The second time is the duration: its minutes range from 0 to 59 inclusive, and its hours range from 0 to 96 inclusive.
Output
For each input line, print on one line the time at which the event ends, as a valid 24-hour time in hh:mm format. If this time is not on the same day as the start time, print it in the format hh:mm +n, where n is the number of days after the starting day.