Don't Be Late

0

0 votes
Problem

Roger need to go to class by 9:00 AM in the morning. He wakes up at some time between 6.30 AM and 8:55 AM. When he wakes up he remembers a number K he thought in his dream. He believes that the total time required (in minutes) to get ready and reach class is given by 10 times the number of distinct non – negative powers of two whose sum will give K. That is if 2^a + 2^b + 2^c = K, with a, b, c unique and non-negative then the time required to reach class will be 10 times 3 as there are three distinct non-negative powers of 2 whose sum will give K.

You need to check whether Roger will be able to reach in time or not. If he is able to reach in time, then print the time at which he reaches class, else print, “LATE”, (without quotes).

Input format:
First line contain time at which he wakes up (hh:mm) in the morning.
Second line contains number K.

Output format:
One line containing the time at which he will reach class (hh:mm) If he is not able to reach the class on or before 09:00, then print “LATE”.


Problem Setter: S.P. Harish

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?