Stand Military Posture

Source: Internet
Author: User
Tags acos

2bc*cosa=b^2+c^2-a^2

/*First spit out the groove of the range of the value of π Konjac Konjac said that really did not think of how to find the intersection of the situation, I want to seek the intersection, in fact, calculate the area of the banana can be sector minus the triangle*/#include<cstdio>#include<cstdlib>#include<cmath>#include<iostream>#include<algorithm>Const DoublePi=3.14159265358979323846264;using namespacestd;voidWork () {DoubleX1,Y1,R1,X2,Y2,R2; scanf ("%LF%LF%LF%LF%LF%LF",&x1,&y1,&r1,&x2,&y2,&R2); DoubleD=SQRT (ABS (X1-X2) *abs (x1-x2) +abs (y1-y2) *abs (y1-y2)); if(R1+r2<=d)// to    {        Doubleans=r1*r1*pi+r2*r2*Pi; printf ("%.3lf\n", ans); return; }    if(R1+r2>d&&abs (R1-R2) >=d)//included    {        DoubleAns=max (R2,R1) *max (R2,R1) *Pi; printf ("%.3lf\n", ans); return; }    //intersect    Doubleans=r1*r1*pi+r2*r2*Pi; DoubleJ1=acos ((D*D+R1*R1-R2*R2)/(2*d*R1)); DoubleJ2=acos ((D*D+R2*R2-R1*R1)/(2*d*r2)); Ans-= (r1*r1*j1+r2*r2*J2); Ans+=d*r1*sin (J1); printf ("%.3lf\n", ans);}intMain () {Freopen ("jh.in","R", stdin); //freopen ("standing.in", "R", stdin); //freopen ("Standing.out", "w", stdout);    intT;SCANF ("%d",&T);  while(t--) {work (); }    return 0;}
View Code

Stand Military Posture

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.