Arrival Time
InterviewTime limit2sMemory limit512 MB
Simulate a drive that takes 2 hours normally but twice as long while traffic runs 07:00-10:00 and 15:00-19:00, given an on-the-hour, :20, or :40 departure.
- Level
Medium4 of 10
- Topics
- Simulation, Implementation, Math
- Solved
- No attempts yet
Problem
Fiona drives the same route to work every day. With no rush-hour traffic the trip takes 2 hours. Rush-hour traffic runs from 07:00 to 10:00 in the morning and from 15:00 to 19:00 in the afternoon. During rush hour her speed is cut in half, so the same distance takes twice as long.
At 07:00 and at 15:00 the traffic has already started. At 10:00 and at 19:00 it has already cleared.
Fiona leaves home on the hour (XX:00), at 20 minutes past the hour (XX:20), or at 40 minutes past the hour (XX:40).
Given her departure time, find the time she arrives at work.
Input
The first line contains the departure time in the form HH:MM. HH is one of the 24 hours 00 to 23, and MM is one of 00, 20, 40.
Output
Print the arrival time in the form HH:MM, padding the hour and the minute to two digits each. If the arrival falls on the next day, print it on the same 24-hour clock as a value between 00:00 and 23:59.