Tell me the area---hdu1798 (mathematical geometry)

Source: Internet
Author: User
Tags acos

http://acm.hdu.edu.cn/showproblem.php?pid=1798

Give you two circles to find the area of the shaded part

Find out the area of the two sector minus the four-sided shape

The area of the sector is the square of the radius of the degree (radian)

Can not use pi 3.1415926 to use ACOs (-1.0);

Find the quadrilateral area is two triangles with Helen Formula

Because of the high accuracy, we can't use pi 3.1415926.

#include <iostream>#include<cstring>#include<algorithm>#include<queue>#include<cstdio>#include<cstdlib>#include<cctype>#include<math.h>using namespacestd;#defineMemset (A, B) memset (A,b,sizeof (a))#defineN 1100000typedefLong Longll;#definePI 3.1415926intMain () {DoubleX1,Y1,R1,X2,Y2,R2;  while(SCANF ("%lf%lf%lf%lf%lf%lf", &AMP;X1,&AMP;Y1,&AMP;R1,&AMP;X2,&AMP;Y2,&AMP;R2)! =EOF) {        DoubleRr=min (R1,R2); DoubleL=sqrt ((x1-x2) * (X1-X2) + (y1-y2) * (y1-y2)); if(l>=r1+R2) {printf ("0.000\n"); Continue; }        Else if(L<=fabs (r1-R2)) {printf ("%.3lf\n", ACOs (-1.0) *rr*RR); Continue; }        Doublecos1= (R1*R1+L*L-R2*R2)/(2.0*r1*l); DoubleCos2= (R2*R2+L*L-R1*R1)/(2.0*r2*l); DoubleSs1=r1*acos (COS1) *r1;///area of the R1 sector        DoubleSs2=r2*acos (COS2) *R2; Doublep= (r1+r2+l)/2.0;///        Doubles=2*sqrt (p* (P-R1) * (P-R2) * (p-l));///the area of the four-sided shapeprintf"%.3lf\n", ss1+ss2-R); }    return 0;}

Tell me the area---hdu1798 (mathematical geometry)

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.