0201. Ellipse and the Line
Input file name: | ellipse.in |
Output file name: | ellipse.out |
Time limit: | 250 ms |
Memory limit: | 32 megabytes |
You are given an ellipse x2/a2 + y2/b2 = 1 by real numbers a, b (1 ≤ a,b ≤ 100) and a straight line that goes through points (x1,y1) and (x2,y2) with real coordinates (-500 ≤ x1,y1,x2,y2 ≤ 500). It is required to find the ratio of the smaller area to the greater area of parts of an ellipse into which it is broken with a straight line. If the straight line does not cross an ellipse, the given ratio should be considered equal to zero.
Input file
Input file contains numbers a,b,x1,y1,x2,y2 ( (x1,y1) ≠ (x2,y2) ). All numbers are real and consist of no more than two digits after decimal point.
Output file
You must output the required ratio with precision of six digits after decimal point.
Examples:
ellipse.in | ellipse.out |
---|---|
100 100 1 0 4 2 | 0.985974 |
Source: Petrozavodsk Summer 2003. Saratov SU Contest, Wednesday, August 27
Discuss Submit a solution
Printable version