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
piyush11696:
20170811 15:43:22
why wa if i use float


sagnik_66:
20170521 11:17:04
Use double and print up to two decimals 

prabodh prakash:
20170509 19:08:28
using float gave me a WA. used double to get AC. 

nilabja16180:
20170301 12:26:27
Brahmagupta's formlua! AC in one GO! 

cake_is_a_lie:
20170214 16:21:20
So using double in c++ I get WA if I just print the results and AC if I print the results truncated to two decimals of precision. Flaky tests => thumbs down. 

scorpion_ajay:
20170212 18:47:55
brahmagupta's formula, similar to heros formula...


hits_812:
20170207 12:26:21
C users: use double instead of float. cost me 2 WA


esshuvo:
20170103 18:41:36
Formula based problem! Why we assume it as a cyclic quadrilateral area?Problem statement didn't tell that.Can anyone else explain this? 

abhi_upadhyay:
20161220 08:52:09
There was a problem when a,b,c,d were float instead of double in c++.Why? 

srnsh:
20161027 10:21:54
Java Scanner  0.42

Added by:  Neal Wu 
Date:  20080524 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO 