Alice Loves Geometry.
Author: Efat Sikder
Problem Setter: Abu Bakor Siddik
Member, IUBAT IITS Programming Club
Alice loves geometry. She solved the most problems related to geometry. So, everything is very easy for her.
One day, she was thinking about a problem. If three non-collinear points (cartesian) are given in the plane, is it possible to calculate the circumference of all unique circles that intersect all three points or not? If it is not possible, print -1; otherwise, print the circumference.
In the input file, you will find one or more test cases. Each test case is represented on a single line and comprises six real numbers: x1, y1, x2, y2, x3, y3. These numbers correspond to the coordinates of three points. It is important to note that the diameter of the circle determined by these three points will never exceed one million. The input is terminated when the end of the file is reached.
For each test case, you should print one line containing one real number.
If it is not possible to determine the circumference of the circle, then print -1.
Otherwise, print a number that should represent the circumference of the circle as determined by the three points. The circumference should be printed accurately and rounded to two decimal places. You can use the value of π, which is approximately 3.141592653589793, to calculate the circumference.
Print a new line after finishing printing all the outputs.
|GNU C 11
|GNU C++ 14
|GNU C++ 11
|Java (OpenJDK 8)