(Source: hdu1724), and above, cut the elliptic into three parts, the left knife is l, the right knife is R, We need to calculate the area of the cut part. Therefore, the use of triangle for yuan is of course the first choice, because, after all, it is related to the image, the steps are as follows:
(1) y = B √ ^ 2/A ^ 2, here is a y corresponding to each X
(2) S = records [L to R] {[B √ (^ 2/A ^ 2)]} dx. In fact, it is still a bit complicated in (2, need to be improved
(3) Use a triangle for Yuan: Y = B * sin θ, x = A * cos θ
(4) If x = L corresponds to θ 1, x = r corresponds to θ 2, the conversion is:
(5) S = Second [θ 1 to θ 2] {[bsin θ]} D (A * cos θ) = Second [θ 1
θ 2] {-AB (sin θ) ^ 2} d θ
(6) Use cos2 θ =
1-2 * (sin θ) ^ 2 points out easily
The four numbers in input are the values of parameters A and B in the elliptic, And the abscissa of the L and R knives:
1 [C language implementation]
2
3 # Include <stdio. h>
4 # Include <math. h>
5 # Include <stdlib. h>
6 Int Main ()
7 {
8 Int A, B, I, J, N, S, T;
9 Double Re, ANS, ant;
10 Scanf ( " % D " , & N );
11 While (N --)
12 {
13 Scanf ( " % D