1
1
Venkatesh V
Guidelines
ONLINE EDITOR (A)
Coding Area Clock Angle
Editor | Compile & Problem Description
Run History
There are 360 Longitudes on the Earth, which are equidistant vertical
Submissions imaginary lines drawn on the Earth, separated by 1 degree each from center of
the Earth. Period of the rotation of the Earth on its axis is 24 hours. All
Feedback Form countries have their own official times and hence time zones.
Calculate the smallest angle between hour and minute hand of the clock ,
which shows the difference of time at a particular longitude and the time at
UTC i.e. we have to take smaller of the two angle formed between hour and
minute hand.
https://www.tcscodevita.com/CodevitaV8/main_page.jsp 1/3
7/12/2019 TCS: CodeVita - Coding Arena
Constraints
To show the time difference on clock, 12-hour clock (as shown below) shall
be used, irrespective of period of the earth's rotation, for this question only.
Input Format
1. Period of the earth’s rotation in Hours (Integer only)
Output
Smallest angle between hour and minute hand of the clock, which shows the
difference between time at a particular longitude and time at UTC, up to 2
decimal places.
Test Case
Explanation
Example 1
Input
24
82.50
Output
15.00
Explanation
If period of rotation of earth is 24 hours then time at 82.5 degree longitude will
be (24/360)*82.50 = 5:30 and minimum angle at this time between minute
https://www.tcscodevita.com/CodevitaV8/main_page.jsp 2/3
7/12/2019 TCS: CodeVita - Coding Arena
Example 2
Input
12
360.00
Output
0.00
Explanation
If period of rotation of earth is 12 hours then time at 360 degree longitude will
be (12/360)*360 = 12:00 and minimum angle at this time between minute and
hour hand will be 0 degree.
CodeVita FAQs
About CodeVita
Privacy Policy
Careers
https://www.tcscodevita.com/CodevitaV8/main_page.jsp 3/3