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
jiglipufff:
2013-12-30 16:40:57
ma 100th... :) |
|
Vaibhav Yenamandra:
2013-08-04 12:43:38
Nice, and easy :D Last edit: 2013-08-04 17:19:58 |
|
Rudradeep Mukherjee:
2013-07-13 14:55:14
No need to push for more precision. :) |
|
Aayush Gupta:
2013-07-11 12:51:40
use double!! |
|
Sivaraman Nagarajan:
2013-02-25 03:58:30
For the first test case, it is optimal to construct a rectangle, and for the second, a square is optimal. Why is this statement |
|
Ouditchya Sinha:
2013-02-02 08:15:35
Easy question... My 50th AC :) |
|
Paul Draper:
2012-12-11 08:15:55
@Saransh Bansal, I feel you. I had TLE with java.util.Scanner. After I made my own I/O functions, I have #2 Java solution. |
|
Avinash Mishra:
2012-07-31 06:59:07
cout<<ans<<endl not working getting WA but printf("%lf\n",ans)working why? |
|
npsabari:
2012-06-18 08:53:10
@The Champ: Thanks, float gave WA and double worked. |
Added by: | Neal Wu |
Date: | 2008-05-24 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO |