Count of obtuse angles in a circle with ‘k’ equidistant points between 2 given points
A circle is given with k equidistant points on its circumference. 2 points A and B are given in the circle. Find the count of all obtuse angles (angles larger than 90 degree) formed from /_ACB, where C can be any point in circle other than A or B.
A and B are not equal.
A < B.
Points are between 1 and K(both inclusive).
Input : K = 6, A = 1, B = 3. Output : 1 Explanation : In the circle with 6 equidistant points, when C = 2 i.e. /_123, we get obtuse angle. Input : K = 6, A = 1, B = 4. Output : 0 Explanation : In this circle, there is no such C that form an obtuse angle.
It can be observed that if A and B have equal elements in between them, there can’t be any C such that ACB is obtuse. Also, the number of possible obtuse angles are the smaller arc between A and B.
Below is the implementation :
Time Complexity: O(1)
Auxiliary Space: O(1)
This article is contributed by Aarti_Rathi and Rohit Thapliyal. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.