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
davidgalehouse:
20160921 06:57:42
Can someone teach me why we can create (I mean assume one exists) a cyclic quadrilateral out of any set of sides? Last edit: 20160921 06:58:01 

pwnclub:
20160826 05:18:17
If you're using C++ and cout is giving you WA, try setting the output to two decimal places (fixed and setprecision(2)). 

baadshah_:
20160712 15:49:58
Brahamagupta's Formula!!AC


suraj:
20160627 14:34:03
use %Lf for long double and sqrt() for double number 

aryanagal:
20160626 08:57:31
Buffered Reader + split is faster than Scanner for Time Limit, in java 

aryanagal:
20160626 08:57:11
Buffered Reader + split is faster than Scanner for Time Limit, in java 

g4mewarrior:
20160514 08:05:57
use %Lf for long double


sarthak_8:
20160206 17:52:35
Bad problem. Formula based. No thinking. Yo BrahmaGupta 

iharsh234:
20151227 11:34:15
move to tutorials 

mdsharique:
20151206 18:47:52
AC in one go...... 
Added by:  Neal Wu 
Date:  20080524 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO 