CIRCLE_H - Three Circle Problem (HARD)

no tags 

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


hide comments
[Lakshman]: 2016-06-28 08:45:46

This problem can be done with PY3.4 using library Functions.

knb_dtu: 2014-05-23 22:12:17

@Tjandra:Could you please check why my submission timed out?
Submission ID:-11610546

Sandeep Pathry: 2013-07-09 15:35:31

@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
(Tjandra Satria Gunawan)(曾毅昆): 2013-06-01 14:34:41

@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..

Francky: 2013-04-12 11:53:51

@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...

raunakrocks: 2013-04-12 10:26:20

@Tjandra:sir,you have to insall libgmp3-dev gmp library to run this code...

raunakrocks: 2013-04-12 10:19:29

@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??

Francky: 2013-04-11 20:55:52

@raunak_talwar : for a guy who solved 178 problems in few times, often at first shot, you have a curious question, isn't it ?

raunakrocks: 2013-04-11 20:21:41

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
Francky: 2013-04-06 21:25:21

Medium edition in tutorial will be helpful.


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