Problem Statement | |||||||||||||
There is a large grassland next to the villa Pemberley in the southern region of Byterland. Mrs. Darcy is afraid of her potted plants being trampled by strangers, so she decides to fence in some triangular areas in the grassland. Mrs. Darcy has several fences in her basement. She will form each triangular area using exactly three fences, such that each side of the triangle is a single fence. Since the fences are beautifully decorated, she will not glue multiple fences together to form a single side, or split a single fence into multiple smaller fences. Her goal is to fence in as large an area as possible. You are given a int[] fences containing the lengths of Mrs. Darcy's fences. Return the maximal area that can be fenced in. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | A return value with either an absolute or relative error of less than 1.0E-9 is considered correct. | ||||||||||||
- | With three fences of length A, B, and C, where A <= B <= C, a triangle can be constructed if and only if A + B > C. | ||||||||||||
- | The area of a triangle with side lengths A, B, and C is sqrt(p*(p-A)*(p-B)*(p-C)), where p = (A+B+C)/2." | ||||||||||||
Constraints | |||||||||||||
- | fences will contain between 1 and 16 elements, inclusive. | ||||||||||||
- | Each element of fences will be between 1 and 100, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|