Given ‘N’ which represent the regular N sided polygon. Two children are standing on the vertex ‘A’ and ‘B’ of this Regular N sided polygon. The task is to determine the number of that vertex another person should stand on so that the sum of the minimum jumps required to reach A and minimum jumps required to reach B is minimized.
- The vertices of this regular polygon are number from 1 to N in a clockwise manner.
- If there are multiple answers, output the least numbered vertex.
Input: N = 6, A = 2, B = 4 Output: Vertex = 3 Explaination: The another person should stand on 3rd vertex. As from 3rd vertex, 1 jump is required to reach A and 1 jump is required to reach B. (See figure above) Input: N = 4, A = 1, B = 2 Output: Vertex = 3 Explaination: The another person should stand on 3rd or 4th vertex. But, as mentioned above we have to print least numbered vertex that's why the output is 3.
- Simply calculate jumps from each vertex except vertices A and B as on that vertices children are standing and store their sum in sum variable.
- Finally, print that position from where the sum of jumps is minimum.
Vertex = 3
- Apothem of a n-sided regular polygon
- Angle between 3 given vertices in a n-sided regular polygon
- Length of Diagonal of a n-sided regular polygon
- Area of a n-sided regular polygon with given Radius
- Side of a regular n-sided polygon circumscribed in a circle
- Area of a n-sided regular polygon with given side length
- Area of largest Circle inscribe in N-sided Regular polygon
- Number of occurrences of a given angle formed using 3 vertices of a n-sided regular polygon
- Probability that the pieces of a broken stick form a n sided polygon
- Number of triangles formed by joining vertices of n-sided polygon with one side common
- Program to find the Circumcircle of any regular polygon
- Program to find the Perimeter of a Regular Polygon
- Position of a person diametrically opposite on a circle
- Program to find the Interior and Exterior Angle of a Regular Polygon
- Number of triangles formed by joining vertices of n-sided polygon with two common sides and no common sides
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.