QUADAREA  Maximal Quadrilateral Area
You are trying to build a house, but unfortunately you currently have only four available walls with side lengths a, b, c, and d. You want your house to be as big as possible, so you would like to know the largest possible area of any quadrilateral you can construct with these four side lengths.
Input
The first line contains the integer T (1 ≤ T ≤ 2,000), the number of tests. Each test contains a single line with four real numbers: a, b, c, and d (0 < a, b, c, d < 1,000). Note that it will always be possible to form a valid quadrilateral with these lengths; that is, the sum of any three side lengths will be strictly larger than the other one.
Output
For each test case, print a single line containing the largest possible area. Your output will be accepted if it is within 0.01 of the official answer.
Example
Input: 2 1 2 1 2 0.5 0.5 0.5 0.5 Output: 2.00 0.25
For the first test case, it is optimal to construct a rectangle, and for the second, a square is optimal.
hide comments
Divyansh Shukla:
20151022 14:11:51
@gohanssj9 This problem uses Bretschneider's formula, using which we can conclude that to maximise the area, the quadrilateral must be cyclic, i.e. sum of two opposite angles must be 180 

praveenpourush:
20151011 08:15:30
@gohanssj9 Actually when its asked that the quad area must be maximum so it indirectly means that the quad is CYCLIC! Last edit: 20151011 08:18:18 

alexbandeira:
20150926 18:17:57
Tnk's The Champ! In C does not work with float. Use double with "%lf " at the entrance and "% .2lf " in output. 

sonupmandal:
20150923 09:08:09
formula based...!!! 

Mohd Ausaf Jafri:
20150813 21:13:44
move it to tutorial ;) 

NEO:
20150712 12:42:48
for a given perimeter or length ... circle has the maximum area .... so whenever asked for the maximum area ... consider it as a circle..


karthik1997:
20150711 18:53:05
pure maths


karthik1997:
20150711 18:53:03
pure maths


vasayashwanth:
20150704 08:56:56
no logic at alll.....just a formula........not interesting 

Ankush :
20150608 08:42:41
Brahmagupta \m/ 
Added by:  Neal Wu 
Date:  20080524 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO 