LightOJ 1331 - Agent J (计算几何)
2016-09-05 20:35
525 查看
1331 - Agent J
Agent J is preparing to steal an antique diamond piece from a museum. As it is fully guarded and they are guarding it using high technologies, it's not easy to steal the piece. There are three circular laser scanners in the museum which
are the main headache for Agent J. The scanners are centered in a certain position, and they keep rotating maintaining a certain radius. And they are placed such that their coverage areas touch each other as shown in the picture
below:
Here R1, R2 and R3 are the radii of the coverage areas of the three laser scanners. The diamond is placed in the place blue shaded region as in the picture. Now your task
is to find the area of this region for Agent J, as he needs to know where he should land to steal the diamond.
Each case starts with a line containing three real numbers denoting R1, R2 and R3 (0 < R1, R2, R3 ≤ 100). And no number contains more than two digits after
the decimal point.
PROBLEM SETTER: JANE ALAM JAN
题意:求阴影部分的面积。
思路:利用余弦定理求出连接三个圆心构成的三角形的三个角的度数,然后可以利用两边一角求出三角形的面积,利用扇形面积的求法,求出三个扇形的面积,最后相减即可。
PDF (English) | Statistics | Forum |
Time Limit: 1 second(s) | Memory Limit: 32 MB |
are the main headache for Agent J. The scanners are centered in a certain position, and they keep rotating maintaining a certain radius. And they are placed such that their coverage areas touch each other as shown in the picture
below:
Here R1, R2 and R3 are the radii of the coverage areas of the three laser scanners. The diamond is placed in the place blue shaded region as in the picture. Now your task
is to find the area of this region for Agent J, as he needs to know where he should land to steal the diamond.
Input
Input starts with an integer T (≤ 1000), denoting the number of test cases.Each case starts with a line containing three real numbers denoting R1, R2 and R3 (0 < R1, R2, R3 ≤ 100). And no number contains more than two digits after
the decimal point.
Output
For each case, print the case number and the area of the place where the diamond piece is located. Error less than 10-6 will be ignored.Sample Input | Output for Sample Input |
3 1.0 1.0 1.0 2 2 2 3 3 3 | Case 1: 0.16125448 Case 2: 0.645017923 Case 3: 1.4512903270 |
PROBLEM SETTER: JANE ALAM JAN
题意:求阴影部分的面积。
思路:利用余弦定理求出连接三个圆心构成的三角形的三个角的度数,然后可以利用两边一角求出三角形的面积,利用扇形面积的求法,求出三个扇形的面积,最后相减即可。
#include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> #define PI acos(-1.0) using namespace std; int main() { int t; double r1,r2,r3,a,b,c,a1,b1,c1,s1,s2; scanf("%d",&t); int l=1; while(t--) { scanf("%lf%lf%lf",&r1,&r2,&r3); a=r1+r2; b=r1+r3; c=r2+r3; c1=acos((a*a+b*b-c*c)/(2*a*b)); b1=acos((a*a+c*c-b*b)/(2*a*c)); a1=acos((b*b+c*c-a*a)/(2*b*c)); s1=0.5*a*b*sin(c1); s2=PI*r1*r1*(c1/(2*PI))+PI*r2*r2*(b1/(2*PI))+PI*r3*r3*(a1/(2*PI)); printf("Case %d: %lf\n",l++,s1-s2); } return 0; }
相关文章推荐
- 【lightoj1331】Agent J【计算几何】
- LightOJ 1331-Agent J【计算几何】
- LightOJ - 1331 Agent J (数学几何)求3圆之间的面积
- LightOJ 1331(数学计算几何)
- 【light-oj】-1331 - Agent J(几何,水)
- LightOJ - 1118 (计算几何模板)
- UVA-1331 Minimax Triangulation 区间dp 计算几何 三角剖分 最大三角形最小化
- Lightoj1072——Calm Down(计算几何)
- 100道动态规划——4 UVA 1331 Maximum Triangulation DP 计算几何
- Light oj 1331 - Agent J【计算】
- LightOJ 1297 Largest Box【简单计算几何】
- lightoj-1331 - Agent J【数学】
- Lightoj 1203 (计算几何 凸包)
- lightoj-1058 - Parallelogram Counting【计算几何】(思维)
- LightOJ 1331 Agent J - Basic Geometry
- LightOJ Circle in Square (简单计算几何)
- Lightoj1216——Juice in the Glass (计算几何)
- UVA 1331 Minimax Triangulation [最优三角剖分] [dp] [计算几何]
- 【LightOJ】1331 - Agent J(数论)
- ACM计算几何题目推荐