Convex Regular Polygon
Time limit1sMemory limit128 MB
Given three vertices of some convex regular polygon, compute the minimum number of sides that polygon could have.
- Level
Medium6 of 10
- Topics
- Geometry, Math, Number theory
- Solved
- No attempts yet
Problem
A convex regular polygon is a polygon whose sides all have equal length and whose interior angles are all equal, with every interior angle smaller than . For example, a square is a convex regular polygon.
You are given the coordinates of three distinct vertices of some convex regular polygon . Among all convex regular polygons that have these three points as vertices, determine the smallest possible number of vertices.
Input
The input consists of several test cases. Each test case is given on three lines; each line contains one vertex of the convex regular polygon ().
Each coordinate is accurate to within of its true value (the difference from the exact coordinate is at most ). The distance between any two points is always at least , and has at most vertices.
The last line of the input is END, which marks the end of the input.
Output
For each test case, print on its own line the minimum possible number of vertices of the convex regular polygon .