HDU1798 Tell me the area(两圆的相交面积)
来源:互联网 发布:两小无猜 网络剧 怎么 编辑:程序博客网 时间:2024/05/19 10:37
New~ 欢迎参加2016多校联合训练的同学们~
Tell me the area这里写链接内容
我的:
这个题虽然说是很简单,但是我觉得实现起来就有点麻烦,然后看了一下别人的代码,感觉某些人的这个格式挺好的,所以就借用了一下咯,谢谢这个哥们。
我的:
#include <iostream>#include <cstdio>#include <algorithm>#include <string>#include <cstring>#include <set>#include <cmath>#include <vector>#include <map>#include <queue>#include <stack>#include <cstdlib>#define PI acos(-1.0)using namespace std;const int maxn=100000+10;struct Circle{ double x,y; double r;}c1,c2;double intersection_area(Circle c1,Circle c2){ double d; double angle1,angle2,s1,s2,s3,s,temp; d=sqrt((c1.x-c2.x)*(c1.x-c2.x)+(c1.y-c2.y)*(c1.y-c2.y));// cout<<d<<endl; if(d>=c1.r+c2.r) return 0; if(c1.r-c2.r>=d) return PI*c2.r*c2.r; if(c2.r-c1.r>=d) return PI*c1.r*c1.r; angle1=acos((c1.r*c1.r+d*d-c2.r*c2.r)/(2*c1.r*d)); angle2=acos((c2.r*c2.r+d*d-c1.r*c1.r)/(2*c2.r*d)); s1=c1.r*c1.r*angle1; s2=c2.r*c2.r*angle2; s3=c1.r*d*sin(angle1);// cout<<c1.r<<" "<<d<<' '<<sin(angle1)<<endl;// cout<<angle1<<" "<<angle2<<" "<<s1<<" "<<s2<<" "<<s3<<endl; s=s1+s2-s3; return s;}int main(){ while(cin>>c1.x>>c1.y>>c1.r) { cin>>c2.x>>c2.y>>c2.r; printf("%.3lf\n",intersection_area(c1,c2)); } return 0;}
0 0
- HDU1798 Tell me the area(两圆的相交面积)
- HDU 1798 Tell me the area (两圆相交面积)
- HDU-1798 Tell me the area (C++和Java【水】两圆相交求公共面积)
- hdu 1798 Tell me the area(相交圆的面积)
- Tell me the area(计算几何--求两圆相交面积)
- ACM--两圆交集的面积--HDOJ 1798--Tell me the area
- HDU 1798 Tell me the area(计算几何,求相交圆面积)
- hdu 1798 - Tell me the area(求两圆相交面积) 解题报告
- hdoj1798Tell me the area【求两圆相交部分的面积】
- Tell me the area
- Tell me the area
- Tell me the area 几何
- TOJ 1754 Circular Area 两圆相交的面积
- HDU 1798 Tell me the area
- hdu 1098 Tell me the area
- HDU 1798 Tell me the area
- HDOJ 题目1798 Tell me the area
- hdu 1798 Tell me the area
- Does sentiment analysis work? A tidy analysis of Yelp reviews
- Golang-简洁的并发
- c语言==关键字(13)
- 深入剖析 redis 数据淘汰策略
- 博客题目来源(codeforces)简要
- HDU1798 Tell me the area(两圆的相交面积)
- java调用Http请求 -HttpURLConnection学习
- 框架解析
- 笔记——Android 中的小细节
- windows系统下如何在启动tomcat时,命令窗口关闭
- Python中对列表的可变性进行讨论
- PAT(B) - 1027. 打印沙漏(20)
- 2016微软探星夏令营在线技术笔试题解(4)
- 不错的视频加密软件