Polygon Diagonal Intersections
InterviewTime limit1sMemory limit128 MB
Given N, a convex N-gon with no three diagonals concurrent, compute the number of interior diagonal intersection points using the combinatorial formula C(N,4).
- Level
Easy3 of 10
- Topics
- Combinatorics, Math
- Solved
- No attempts yet
Problem
You are given a convex N-gon. No three diagonals meet at the same point. Count the number of points inside the polygon where two diagonals intersect.
A polygon is convex if every interior angle is less than 180 degrees.
Input
The first line contains an integer N. (3 ≤ N ≤ 100)
Output
Print the number of diagonal intersection points.