Southwest min da Oj:http://www.swunacm.com/acmhome/welcome.do?method=index
My geometry can't be that cute.Time limit (normal/java): ms/3000 MS Run memory limit: 65536 KByte
Total Submissions: 11 Tested by: 8
Describe
Hey, kids, you're all right, you know at the stand.
At position, also called "A T Field", is the abbreviation of "Absolute terror field". Literal translation as "absolute terror field", also known as absolute field. The visual at field is a gold-coloured, multi-shaped shape, and the apostle with an at force field can withstand almost all conventional weapons, and only another at field is possible (the EVA body can unfold the same force field). At field meaning is deepened to "self and ego" (ego)
A wall separated from the objective world "reveals that every creature has an at field." The man's at force field is called "The Wall of the heart".
Now Shinji and Zhu have released at the same time at the position.
What we're trying to figure out now is two people. The intersection area of the two-dimensional coordinate plane at position.
In order to make the topic simple, we assume that two people are in the same two-dimensional coordinate plane, the two people put the at position is perfect round, give two people's coordinates, and two people at the release radius of the position, to seek the area of intersection.
Input
Multiple sets of input and output
The first line of the true heir coordinates x and coordinates y and at position release radius r
The second line is where the coordinates x and coordinates y and the at position release radius r
(|x|,|y|,|r|<=100, and x,y,r full amount)
Output
The two people at the position intersect the area to retain 3 decimal places
Sample input
0 0 1
0 1 1
Sample output
1.228
Tips
Geometry or something is so easy!
Test instructions: The intersection area is obtained by a given two-park coordinates and radius.
#include <cstdio>#include<cstring>#include<cmath>#include<iostream>#include<algorithm>#include<queue>#include<cstdlib>#include<stack>#include<vector>#include<Set>#include<map>#defineLL Long Long#defineMoD 1000000007#defineINF 0x3f3f3f3f#defineN 1000010using namespacestd;#defineSQR (x) ((x) * (x))Const Doubleeps=1e-9;Const Doubleinf=1e10;Const DoublePi=acos (-1.0);Const intmaxn= A;structpoint{Doublex, y;};structcircle{point O; DoubleR;} C[MAXN];intN;DoubleDis (point A, point B) {returnsqrt (SQR (a.x-b.x) +SQR (a.y-b.y));}intSgnDoublex) { if(Fabs (x) <eps)return 0; if(x>0)return 1; return-1;}DoubleCircle_inter_area (Circle C1, Circle C2) {DoubleD=dis (C1.O, C2.O); if(c1.r<C2.R) Swap (c1, C2); if(SGN (D-C1.R-C2.R) >=0)return 0;//To be absent or circumscribed if(SGN (D-(C1.R-C2.R)) <=0)returnPI*SQR (C2.R);//included or cut-in Doubleang1, Ang2; Ang1=acos ((Sqr (C1.R) +sqr (d)-sqr (C2.R))/(2.0*c1.r*d)); Ang2=acos ((Sqr (C2.R) +sqr (d)-sqr (C1.R))/(2.0*c2.r*d)); DoubleRES=ANG1*SQR (C1.R) +ang2*sqr (C2.R)-d*c1.r*sin (ang1); returnRes;}intMain () { while(SCANF ("%LF%LF%LF%LF%LF%LF", &c[0].o.x, &c[0].O.Y, &c[0].r,&c[1].o.x, &c[1].O.Y, &c[1].R) >0) printf ("%.3lf\n", Circle_inter_area (c[0],c[1])); return 0;}
View Code
Southwest min da oj (two garden intersection to seek area)