Circle Through Three Points
Time limit1sMemory limit128 MB
For each line of three points, compute the circle through them and print its center-radius and general equations with signs adjusted.
- Level
Easy3 of 10
- Topics
- Geometry, Math, Implementation, Brute force
- Solved
- No attempts yet
Problem
Given the Cartesian coordinates of three points on a plane, find the equation of the circle that passes through all three of them. The three points are guaranteed not to lie on a single straight line.
Report the circle in two forms. One is the standard (center–radius) form
and the other is the general form
Input
Each line of input contains the and coordinates of three points , , and , listed in the order , , , , , . The coordinates are real numbers separated from one another by one or more spaces. Read lines until the end of the input.
Output
For each input line, print the two required equations on two consecutive lines, using the format shown in the examples. The values , , , , , and must each be printed with exactly three digits after the decimal point.
Adjust the plus and minus signs so that no number is preceded by two signs. For example, when the term is written (y + 2.000) rather than (y - -2.000). Every +, -, and = sign must be surrounded by exactly one space on each side, and no other spaces may appear inside an equation.
Separate consecutive equation pairs with a single blank line.
Hint
