codeforce--600D - Area of Two Circles' Intersection
题意:求相交圆的面积。借鉴大神代码,精度超高。
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <ctime>
#include <assert.h> #define y1 aasdfasdfasdf #define eps 1e-16
#define M_PI 3.141592653589793
const int N = ;
using namespace std; long double x1,y1,x2,y2,r1,r2; long double gd(long double x1,long double y1,long double x2,long double y2)
{
return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
} long double solve_cos(long double a,long double b,long double c)
{
return acos((a*a+b*b-c*c)/(*a*b));
} long double cut(long double ang,long double r)
{
long double s1,s2;
s1=ang*r*r/;
s2=sin(ang)*r*r/;
return s1-s2;
} long double solve()
{
if (r1<r2)
{
swap(x1,x2);
swap(y1,y2);
swap(r1,r2);
}
long double cd=gd(x1,y1,x2,y2);
if (cd+r2<=r1+eps)
return r2*r2*M_PI;
if (cd>=r1+r2-eps)
return ;
long double ang1=solve_cos(cd,r1,r2);
long double ang2=solve_cos(cd,r2,r1);
return cut(ang1*,r1)+cut(ang2*,r2);
} int main()
{
cin>>x1>>y1>>r1;
cin>>x2>>y2>>r2;
cout.precision();
cout<<fixed<<solve()<<endl;
return ;
}
codeforce--600D - Area of Two Circles' Intersection的更多相关文章
- codeforces 600D Area of Two Circles' Intersection
分相离,内含,想交三种情况讨论一下. 主要是精度和数据范围的问题,首先数据用long double,能用整型判断就不要用浮点型. 题目中所给的坐标,半径是整型的,出现卡浮点判断的情况还是比较少的. 最 ...
- codeforces D. Area of Two Circles' Intersection 计算几何
D. Area of Two Circles' Intersection time limit per test 2 seconds memory limit per test 256 megabyt ...
- codeforces 几道题目
BZOJ挂了....明天就要出发去GDKOI了....不能弃疗. 于是在cf水了几道题, 写写详(jian)细(dan)题解, 攒攒RP, 希望GDKOI能好好发挥....... 620E. New ...
- Educational Codeforces Round 2
600A - Extract Numbers 20171106 字符串处理题,稍微注意点细节就能水过 #include<stdlib.h> #include<stdio.h&g ...
- Trilateration三边测量定位算法
转载自Jiaxing / 2014年2月22日 基本原理 Trilateration(三边测量)是一种常用的定位算法: 已知三点位置 (x1, y1), (x2, y2), (x3, y3) 已知未知 ...
- Shape comparison language
形状比较语言, 九交模型 In this topic About shape comparison language Dimensionality Extensions to the CBM SC ...
- HDU 1724 Ellipse(数值积分の辛普森公式)
Problem Description Math is important!! Many students failed in 2+2’s mathematical test, so let's AC ...
- A Statistical View of Deep Learning (IV): Recurrent Nets and Dynamical Systems
A Statistical View of Deep Learning (IV): Recurrent Nets and Dynamical Systems Recurrent neural netw ...
- HDU 1724 Ellipse [辛普森积分]
Ellipse Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Sub ...
随机推荐
- springMVC从上传的Excel文件中读取数据
示例:导入客户文件(Excle文件) 一.编辑customer.xlsx 二.在spring的xml文件设置上传文件大小 <!-- 上传文件拦截,设置最大上传文件大小 10M=10*1024*1 ...
- 用JavaScript获取页面上被选中的文字的技巧
这里介绍的一个小技巧是如何用JavaScript获取页面上被选中的文字的方法.最关键的JavaScript API是: event.selection = window.getSelection(); ...
- 基于jquery中children()与find()的区别介绍
本篇文章介绍了,基于jquery中children()与find()的区别,需要的朋友参考下 .children(selector) 方法是返回匹配元素集合中每个元素的所有子元素(仅儿子辈).参数可选 ...
- PAT-乙级-1018. 锤子剪刀布 (20)
1018. 锤子剪刀布 (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 大家应该都会玩“锤子剪刀布”的游 ...
- 为你的PHP程序选择合适的密码库(初稿)
如果本文中的术语让你感到疑惑,请先参阅密码学术语及概念一文. 密码学不是魔术.加密一个应用程序并不能保证它在袭击下的安全(特别是在你没有设置验证密文的情况下).但如果出于商业需求你要确保程序的安全,传 ...
- jvisualvm 使用
和jconsole侧重于内存分析和检测不同,jvisualvm在线程分析方面更强大一些,下面简单介绍下使用: 1. 在要监控的java应用配置文件中,本例是apache-jmeter/bin/jmet ...
- 一周一话题之四(JavaScript、Dom、jQuery全面复习总结<Dom篇>)
-->目录导航 一. 初探Dom 1. Dom介绍 二. Dom基础 1. window顶级对象 2. body.document对象事件 3. 通用的HTML元素的事件 4. 冒泡事件 5. ...
- MVC 国内架构设计
http://www.cnblogs.com/guomingfeng/p/mvc-ef-query.html http://www.cnblogs.com/haogj/p/3127795.html
- codeforces #305 D Mike and Fish
正解貌似是大暴搜? 首先我们考虑这是一个二分图,建立网络流模型后很容易得出一个算法 S->行 容量为Num[X]/2; 行->列 容量为1 且要求(x,y)这个点存在 列->T 容量 ...
- Nginx的介绍和使用
http://blog.csdn.net/shimiso/article/details/8690897 1.什么是Nginx Nginx(发音同 engine x)是一款轻量级的Web 服务器/反向 ...