Stars in a Regular Polygon
InterviewTime limit1sMemory limit1024 MB
Given the vertex count N of a regular polygon, count the distinct stars that can be drawn by connecting its vertices.
- Level
Easy3 of 10
- Topics
- Math, Combinatorics
- Solved
- No attempts yet
Problem
The clock is about to strike six, and the first star is already visible. How many stars can appear in a sky shaped like a regular -gon?
Given the number of vertices of a regular -gon, print how many distinct stars can be formed by connecting its vertices.
Label the five vertices of a star clockwise. The star connects those vertices in the order 1-3-5-2-4-1. A star that looks the same after flipping or rotating still counts as a different star if it is drawn through different vertices of the regular -gon.
Input
A single integer is given, the number of vertices of a regular -gon.
Output
Print the number of distinct stars that can be formed by connecting the vertices of the regular -gon.
Hint
A regular -gon has distinct stars that can be formed by connecting its vertices.
