Submit | All submissions | Best solutions | Back to list |
AREAS - Quad areas |
Since you don't have any friends, you get to spend Saturday morning solving a geometry problem.
A convex quadrilateral can be divided into four non-overlapping triangles by connecting opposite vertices, as shown.
You must find the area of the largest of these four triangles.
You may find the shoelace formula helpful. It describes the area of a degree-n polygon with vertices: (x1, y1) (x2, y2) ... (xn, yn).
Input
The input is the four vertices, in order. Each vertex is on a line, and each line has the x- and y-coordinates separated by a space. All coordinates are integers from -500 to 500 inclusive.
The quadrilateral is guaranteed to be convex; i.e. the angle at each vertex is less than 180 degrees.
Output
Output a single number: the area of the largest triangle. This answer must be accurate to within 0.001.
Examples
Input: 0 0 0 1 1 1 1 0 Output 0.25
Input: 0 5 10 400 100 500 50 -5 Output 11588.288
Input: -2 0 0 1 2 0 0 -1 Output 1
Added by: | BYU Admin |
Date: | 2015-11-05 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 MAWK BC NCSHARP COFFEE DART FORTH GOSU JS-MONKEY JULIA KTLN OCT PROLOG PYPY3 R RACKET SQLITE SWIFT UNLAMBDA |