Given four integers H, M, L1, and L2, which denotes the time as an hour and minutes in a Clock of 12-Hour format and L1 and L2 denotes the length of the hour hand and minute hand respectively. The task is to find the distance between the endpoints of the hour and minutes hand.
Input: H = 3, M = 30, L1 = 3, L2 = 4
At 3:30, distance between end point of hour hand and minute hand is 4.33499
Input: H = 10, M = 30, L1 = 3, L2 = 4
At 10:30, distance between end point of hour hand and minute hand is 6.47898
Approach: The idea is to find the angle between the hour hand and minute hand at the given time and then the distance between the endpoints of the hour hand and minute hand can be computed with the help of the cosine formulae –
Distance Between End Points of the Hour and minute hand =
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Time when minute hand and hour hand coincide
- Calculate the angle between hour hand and minute hand
- Distance traveled by Hour and Minute hand in given Time interval
- Maximum time such that absolute difference between hour and minute lies in given range
- Ways to choose three points with distance between the most distant points <= L
- Count of obtuse angles in a circle with 'k' equidistant points between 2 given points
- Time taken per hour for stoppage of Car
- Check whether it is possible to join two points given on circle such that distance between them is k
- Distance of chord from center when distance between center and another equal length chord is given
- Find points at a given distance on a line of given slope
- Number of Integral Points between Two Points
- Find the point on X-axis from given N points having least Sum of Distances from all other points
- Find the other end point of a line with given one end and mid
- Program to calculate distance between two points
- Program for distance between two points on earth
- Maximum distance between two points in coordinate plane using Rotating Caliper's Method
- Program to calculate distance between two points in 3 D
- Haversine formula to find distance between two points on a sphere
- Hammered distance between N points in a 2-D plane
- Find the maximum possible distance from origin using given points
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.