Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Find the Circle

By flash_7 · Limits 3s, 512 MB

You’ll be given two circles A and B of the same radius. You need to draw another circle C such that, C contains both circles A and B completely inside it and the radius of the circle C is minimized. To be specific, after you draw the circle C, there won’t exist any region of circle A or B which lie outside the circle C.

Input

The first line contains an integer T, the number of test cases. Each of the next T lines contains 5 integers X1, Y1, X2, Y2 and R. Here (X1, Y1) is the center of circle A, (X2, Y2) is the center of circle B and R is the radius of both A and B.

Constraints:

1 ≤ T ≤ 50
1 ≤ X1, Y1, X2, Y2, R ≤ 10000

Output

For each test cases, print three decimal numbers X3, Y3 and R3 rounded to two decimal places. Here (X3, Y3) is the center and R3 is the radius of the large circle C.

Samples

InputOutput
1
1 1 9 1 2
5.00 1.00 6.00

Explanation:

In the first sample test case, the center of the circle C is (5.00, 1.00) and the radius is 6.00.

Discussion
Submit

Login to submit