Play reasoning with Wu Hao Round 8 -- a series of computational ry (a) -- split an elliptic into two knives (hdoj 1724)

Source: Internet
Author: User

 

(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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.