According to Lewis Carroll, a clock that has stopped is more accurate than
one that is five minutes behind. He argues that the former is right twice
a day, whereas the latter never shows the correct time. Then again, a
clock that is always five minutes behind is in a sense perfectly accurate,
and therefore an extraordinary specimen. More usually, a clock is ahead or
behind because it runs at the wrong rate, so that its absolute discrepancy
from the true time is steadily changing. If left unregulated, such a
clock will show the true time at regular but perhaps lengthy intervals.
You are given two Strings of the form "hh:mm:ss".
The first represents exactly the true time, while the second is exactly
the time shown by an ill-tuned clock. This is an analog clock whose hour,
minute, and second hands sweep continuously around the dial at a speed
that is too fast or too slow by a constant factor. Both times are given
in the North American style, where the hour ranges between 1 and 12,
inclusive. Given an int specifying the non-zero number
of seconds that the clock gains every hour, calculate the number of
hours that elapse before it agrees with the true time. Your answer,
a double, must be correct with either absolute or relative precision of
1.0e-9 (one billionth).
|