407226: GYM102697 197 Three Lines

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

197. Three Linestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
This problem is worth 60 points.

You're given three lines on the coordinate plane. No pairs of the lines are parallel.

Figure out the area of the triangle formed by the intersection points of the three lines. In other words, label the points of interesection of lines 1 and 2, lines 1 and 3, and lines 2 and 3, $$$A$$$, $$$B$$$, and $$$C$$$, respectively. Then, your task is to find the area of triangle $$$ABC$$$.

Input

The input consists of three lines, each containing the equation for one of the lines, in $$$y = mx + b$$$ form, where $$$m$$$ represents the slope of the line, and $$$b$$$ represents the y-intercept of the line.

Output

Output a single decimal number representing the area of the triangle formed by the intersection points of the three lines. Do not round your answer. Your answer doesn't have to be exactly equal to ours; as long as it's within a few decimal places it will be judged as correct.

ExamplesInput
y = 2x + 3
y = -2x + 9
y = x - 2
Output
28.166666666666664
Input
y = 2x + 3
y = -2x + 9
y = -x - 27
Output
793.5000000000001
Input
y = 2x + 3
y = -2x + 90
y = 7x - 2
Output
478.4027777777778
Note

Here is the graph of the first example case:

加入题单

上一题 下一题 算法标签: