I like to save time quite literally, by wearing three watches on my wrist... Problem is they each give a different time. One watch is x minutes behind the actual time. One watch is x minutes ahead of the actual time. The last watch shows the actual time.
Problem is, I can't tell which watch has the correct time...
From the time displayed on each watch, determine the actual time. If it is not possible to determine the time, print "Look at the sun".
Input:
Three readings, separated by single space characters: H1:M1 H2:M2 H3:M3
In each reading H1,H2,H3 represent the hours displayed (0 < H1,H2,H3 < 13), and
M1,M2,M3 represent the minutes displayed (0 <= M1,M2,M3 < 60). If the number of
minutes is less than 10, a leading 0 is prepended in the input. Similarly, is the number of hours is less than 10, a leading 0 is prepended in the input.
Output: The correct time is HH:MM
where HH:MM is the correct time. If no correct time can be determined, it displays Look at the sun
.
Input 1: 05:00 12:00 10:00
Output 1: The correct time is 05:00
Input 2: 11:59 12:30 01:01
Output 2: The correct time is 12:30
Input 3: 12:00 04:00 08:00
Output 3: Look at the sun
Shortest code wins... No special penalties apply. Also, bear in mind that we're dealing with a 12-hour clock... I don't care about AM or PM... Imagine we're dealing with analogue watches...
12:00
is exactly between8:00
and4:00
too, you know... \$\endgroup\$The correct time is HH:MM
, without a full stop, but then proceed to include a full stop in the first two examples. Which version is correct? \$\endgroup\$whattimeisit 07:21 08:39 08:00
? Sure! \$\endgroup\$