Problem Description
Peter is studying in the third grade of elementary school. His teacher of geometry often gives him difficult home tasks.
At the last lesson the students were studying circles. They learned how to draw circles with compasses. Peter has completed most of his homework and now he needs to solve the following problem. He is given two segments. He needs to draw a circle which intersects interior of each segment exactly once.
The circle must intersect the interior of each segment, just touching or passing through the end of the segment is not satisfactory.
Help Peter to complete his homework.
Input
The input file contains several test cases. Each test case consists of two lines.
The first line of the test case contains four integer numbers x11, y11, x12, y12— the coordinates of the ends of the first segment. The second line contains x21. y21, x22, y22 and describes the second segment in the same way.
Input is followed by two lines each of which contains four zeroes these lines must not be processed.
All coordinates do not exceed 102 by absolute value.
Output
For each test case output three real numbers — the coordinates of the center and the radius of the circle. All numbers in the output file must not exceed 1010 by their absolute values. The jury makes all comparisons of real numbers with the precision of 10-4.
Sample Input
0 0 0 4
1 0 1 4
0 0 0 0
0 0 0 0
Sample Output
0.5 0 2
Hint
Source
Andrew Stankevich Contest 22
這題是幾何題,先把線段的端點都連起來,共4條線段,然後選擇最短的那條線段,取這條線段的中點,中點即為圓心,半線段長為l1,算出這個點到另外兩點連線的較小長度l2,然後圓的半徑就是(l1+l2)/2;
#include
#include
#include
#include
#include
#include