https://www.codechef.com/ILPU2021/problems/NSDPOLY

Polygon with N-Sides

A Regular Polygon is an N−sided Polygon in which all the sides are of the same length and are symmetrically placed about a common centre (i.e., the polygon is both equiangular and equilateral).

Examples- Equilateral Triangle, Square, Pentagon, Hexagon, Heptagon, Octagon and so on.

Therefore, the polygon has N vertices too and a line have 2 end points. So, we need to find the number of combinations of the vertices except the boundary of polygon.

Mathematically, total number of lines formed by N vertices is given by [nC2], but it includes the polygon boundary lines also, so we need to subtract N from it

Final Expression will be, → [nC2 - n]