#P5707. Latest Departure Time
Latest Departure Time
Latest Departure Time
yyy's home and the school are separated by a distance of \(s\) meters. yyy walks to school at a constant speed of \(v\) meters per minute. On the way, yyy also spends an extra 10 minutes for garbage sorting.
The school requires arrival by \(\textrm{8:00}\) AM. Calculate the latest time that yyy can depart from home without being late.
The travel time (in minutes) is determined by:
$$\text{travel time} = \lceil \frac{s}{v} \rceil$$
Thus, the departure time (in minutes) is computed as:
$$T = 480 - \left(\lceil \frac{s}{v} \rceil + 10\right)$$
Here, 480 minutes represents \(\textrm{8:00}\) AM. If \(T < 0\), add 1440 minutes to convert it to the corresponding time on the previous day. It is guaranteed that the departure time will not be earlier than one day before \(\textrm{8:00}\) AM.
inputFormat
The input consists of two space-separated integers, \(s\) and \(v\), where:
- \(s\) is the distance in meters between yyy's home and the school.
- \(v\) is yyy's walking speed in meters per minute.
It is guaranteed that the calculated departure time does not exceed one day before \(\textrm{8:00}\) AM.
outputFormat
Output the latest departure time in the 24-hour HH:MM format. Hours and minutes should each be padded with a leading zero if necessary.
sample
1000 50
07:30