Zoj 1090 three-point circumference

Source: Internet
Author: User

//////////////////////////////////////// //////////
// 1090 mathematical questions
// Obtain the circumference of the circle determined by the three points.
// First use the cosine theorem cos α = (B ^ 2 + C ^ 2-A ^ 2)/(2bc) and then calculate sin α, then the diameter d = A/sin α, perimeter L = D π
# Include <iostream>
# Include <iomanip>
# Include <math. h>
Using namespace STD;
# Define PI 3.141592653589793

 

Int main ()
{
Double X1, Y1, X2, Y2, X3, Y3;
Double wer1, wer2, wer3;
Double A, B, C;
While (CIN> x1> Y1> X2> Y2> X3> Y3 )! = 0)
{
Wer1 = POW (x1-x2), 2) + POW (y1-y2), 2 );
A = SQRT (wer1 );
Wer2 = POW (x3-x2), 2) + POW (y3-y2), 2 );
B = SQRT (wer2 );
Wer3 = POW (x1-x3), 2) + POW (y1-y3), 2 );
C = SQRT (wer3 );
Double ans;
Ans = (B * B + C * C-A * A)/(2 * B * C );
Ans = SQRT (1-ans * ans );
Ans = A * PI/ANS;
Cout <setiosflags (IOs: fixed) <setprecision (2) <ans <Endl;
}
Return 0;
}

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.