CIRCLE_H - Three Circle Problem (HARD)

Given 3 distinct circles with positive integer radius R1R2, and R3, and arranged like in the picture below:

Three Circle Problem

Now, your task is to compute radius of small circle that can be created like yellow circle in the picture above. All circles in the picture above tangent each other.

Input

The first line in the input data, there is an integer T(0 < T ≤ 105) denoting number of test cases, than T lines follow.

For each lines, there are three integer R1, R2, and R3, (0 < {R1, R2, R3} < 1030) denoting radius of each circle like in the picture above.

Output

For each test case, output radius of small circle that can be made, like in the picture above. Truncate the output to 50 digit after decimal point.

Example

Input:
3
1 1 1
10 10 10
23 46 69

Output:
0.15470053837925152901829756100391491129520350254025
1.54700538379251529018297561003914911295203502540253
6.00000000000000000000000000000000000000000000000000

You can see my submission history and time record for this problem: here

See also: Another problem added by Tjandra Satria Gunawan


Added by:Tjandra Satria Gunawan
Date:2013-04-05
Time limit:10s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem

hide comments
2016-06-28 08:45:46 [Lakshman]
This problem can be done with PY3.4 using library Functions.
2014-05-23 22:12:17 knb_dtu
@Tjandra:Could you please check why my submission timed out?
Submission ID:-11610546
2013-07-09 15:35:31 Sandeep Pathry
@Tjandra... please see my solution in python...
got AC in the medium version with this code...
Can this method pass with some optimisations or shall i think of something else...
plz hlp

<b><u>Ans</u></b>: Yes, you need some syntax optimizations, your formula is correct...
thnx... :)

Last edit: 2013-07-12 05:51:03
2013-06-01 14:34:41 (Tjandra Satria Gunawan)(曾毅昆)
@raunak_talwar: My computer is running windows, not linux.. But I'll try it, when I have linux again..
@Francky: I think you're a very good tutor ;-) haha..
2013-04-12 11:53:51 Francky
@raunak_talwar: You can use Python or PIKE they have fast bigNum library included. In C/C++, you have to build entirely it by yourself ; it's a good exercise.
Be careful, this problem is not easy even with the bignum library...
2013-04-12 10:26:20 raunakrocks
@Tjandra:sir,you have to insall libgmp3-dev gmp library to run this code...
2013-04-12 10:19:29 raunakrocks
@Francky :yes,sir i'm trying to solve this using gmp_f in c/c++..but not getting the right way...any help to solve??
2013-04-11 20:55:52 Francky
@raunak_talwar : for a guy who solved 178 problems in few times, often at first shot, you have a curious question, isn't it ?
2013-04-11 20:21:41 raunakrocks
is gmf_t not allowed on spoj?

Ans(Tjandra): I'm not sure that file "gmp.h" is available on spoj.. I don't know.. also, I can't compile your code on my computer...

Last edit: 2013-04-11 21:10:24
2013-04-06 21:25:21 Francky
Medium edition in tutorial will be helpful.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.