### 2014 Mock CCC by Alex and Timothy

## Problem J3: Clock Hands

Alice had just dug up an old time capsule that she had buried in her backyard many years ago. Inside, she discovered an exquisite clock from when she was a young girl. When she buried the clock, she had removed the batteries so that the hands would remain in that position forever. This was done so she could remind her future self of the exact time at which she met her eternal love interest — Bob. Unfortunately, all but the 12 o'clock marking had worn away over the years. With a protractor handy, Alice is determined to find out the exact time that Bob came into her life.

Measuring the hour hand from the centre of the clock, Alice determined that it was `H` degrees clockwise from the 12 o'clock marking. Alice then measured the angle of the minute hand, determining that it was `M` degrees clockwise *relative to the hour hand*. Finally, she measured the second hand, determining that it was `S` degrees clockwise *relative to the minute hand*. The three angle measurements will all be non-negative real numbers greater than or equal to 0, but less than 360. You may assume that the angles will yield valid times.

### Input Format

Three lines, containing the three values `H`, `M`, and `S`.

### Output Format

Output the time, in the format `HH:MM:SS`

, where `HH` (1 ≤ `HH` ≤ 12) is the number of hours, `MM` (0 ≤ `MM` < 60) is the number of minutes, and `SS` (0 ≤ `SS` < 60) is the number of seconds. These values each must be padded to two-digits with leading zeros. Round the time to the nearest second.

### Sample Input 1

195 345 180

### Sample Output 1

06:30:00

### Sample Input 2

90.066667 270.733333 47.200000

### Sample Output 2

03:00:08

### Explanation

The following diagrams depict Alice's clock for the examples above. Orange is hour hand, black is the minute hand, and red is the second hand.

All Submissions

Best Solutions

**Point Value:** 5

**Time Limit:** 2.00s

**Memory Limit:** 16M

**Added:** Feb 27, 2014

**Author:** Alex

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

SUPER_ET_DUPERon Jan 14, 2015 - 8:46:37 pm UTC Test case 2 and 4FatalEagleon Jan 14, 2015 - 10:12:59 pm UTC Re: Test case 2 and 4SUPER_ET_DUPERon Jan 13, 2015 - 2:18:47 am UTC Extra zerosAlexon Jan 13, 2015 - 2:58:49 am UTC Re: Extra zerosSUPER_ET_DUPERon Jan 13, 2015 - 8:36:46 pm UTC Re: Extra zerosFatalEagleon Jan 14, 2015 - 2:12:07 am UTC Re: Extra zeros