HDU-1798 Tell me the area(数学)
来源:互联网 发布:测试端口通不通命令 编辑:程序博客网 时间:2024/06/07 09:30
Tell me the area
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 3183 Accepted Submission(s): 1034
Problem Description
There are two circles in the plane (shown in the below picture), there is a common area between the two circles. The problem is easy that you just tell me the common area.
Input
There are many cases. In each case, there are two lines. Each line has three numbers: the coordinates (X and Y) of the centre of a circle, and the radius of the circle.
Output
For each case, you just print the common area which is rounded to three digits after the decimal point. For more details, just look at the sample.
Sample Input
0 0 2
2 2 1
Sample Output
0.108
求 2圆相交面积啊 套公式 嗯。。。。。。。。。 又在做水题
code:
#include<bits/stdc++.h>using namespace std;#define PI acos(-1.0)int main(){ double x1,y1,r1,x2,y2,r2; while(~scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&r1,&x2,&y2,&r2)) { double d=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); double ans,ans1,ans2; if(d>=r1+r2) ans=0; else if(d<=fabs(r1-r2)) { double r; r=r1<r2?r1:r2; ans=r*r*PI; } else { ans1=acos((r1*r1+d*d-r2*r2)/(2*r1*d)); ans2=acos((r2*r2+d*d-r1*r1)/(2*r2*d)); ans=r1*r1*ans1 + r2*r2*ans2 - r1*r1*cos(ans1)*sin(ans1) - r2*r2*cos(ans2)*sin(ans2); } printf("%.3lf\n",ans); } return 0;}
- HDU-1798 Tell me the area(数学)
- HDU 1798 Tell me the area
- HDU 1798 Tell me the area
- hdu 1798 Tell me the area
- HDU 1798 Tell me the area
- Tell me the area HDU 1798
- HDU 1798 Tell me the area (两圆相交面积)
- hdu 1098 Tell me the area
- Tell me the area
- Tell me the area
- hdu 1798 - Tell me the area(求两圆相交面积) 解题报告
- HDU 1798 Tell me the area(计算几何,求相交圆面积)
- hdu 1798 Tell me the area(相交圆的面积)
- HDOJ 题目1798 Tell me the area
- HDOJ Tell me the area 1798
- HDOJ—1798 Tell me the area
- Tell me the area 几何
- hdu 1798 Tell me the area …
- pom.xml报错:web.xml is missing and <failOnMissingWebXml> is set to true
- NYOJ 首字母变大写
- 不得不了解的四大作用域:application,session,request,page
- C++写插入排序
- GameEntity(十一)—— Iplayer
- HDU-1798 Tell me the area(数学)
- 软件工程课程实验报告:实验七
- 线性时间求第k小(分治思想)
- Java集合源码--ArrayList
- Tensorflow 从bin文件中读取数据并
- STM32寄存器编程思路
- spark机器学习MLlib笔记(1)
- Android JobScheduler
- JS-变量,作用域和内存问题