Loading Now

clockRadian

Given a time, your mission is to calculate the angle between the hour hand and the minute hand on an analog clock and return it in radians.

The returned value should be written as a reduced fraction or, if the fraction’s denominator is 1, as a regular number. There should be no multiplication sign in front of pi.

clock

Example:

  • For time = "3:00", the output should be clockRadian(time) = "pi/2".

  • For time = "6:00", the output should be clockRadian(time) = "pi".

Input/Output:

  • [execution time limit] 0.5 seconds 

  • [input] string time

    A string representing the time in the format hh:mm.
    1 ≤ hh ≤ 12,
    0 ≤ mm ≤ 59.

  • [output] string

    A reduced fraction representing the angle between the hour and minute hands in the format <numerator>pi/<denominator>.

Post Comment

Contact