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 ...
随机推荐
- 现在不使用ZeroClipboard我们也能实现复制功能(转)
现在不使用ZeroClipboard我们也能实现 首先,我们保证页面结构不变,但不在引入ZeroClipboard插件: 1 <input type="text" name= ...
- IsBadReadPtr|IsBadWritePtr调试崩溃
遇到一未找到必然出现条件的崩溃,不知道什么时候能触发崩溃,崩溃dump显示,试图访问了非法的内存或者写入了非法的内存 此时如下两个函数就比较有用了: BOOL WINAPI IsBadReadPtr( ...
- 跟随屏幕滚动层、遮罩层、获取Div相对定位、整个屏幕、html文档的jquery基本操作
一.层跟随屏幕滚动 <div style="width:120px;height:120px;border:1px solid red; position:absolute; left ...
- hdu 3929 Big Coefficients 容斥原理
看懂题目,很容易想到容斥原理. 刚开始我用的是二进制表示法实现容斥原理,但是一直超时.后来改为dfs就过了…… 代码如下: #include<iostream> #include<s ...
- ADT(android-bundler) HTML EDIT 编辑 xml HTML
逗比的ADT,安装个html一直不成功,最后发现了如下方法 Helper_Install New Software_ http://download.eclipse.org/releases/indi ...
- C++常用语法
unordered_map<int, Node*> mp; if (mp.find(key) == mp.end()) unordered_map<int, Node*>::i ...
- Android:Style和Theme
在Web开发中,Html负责内容,CSS负责表现.同样,在Android开发中,可以使用Theme.Style+UI组件的方式实现内容和形式的分离. Style是针对窗体元素级别的,改变指定控件或者L ...
- classpath、path、JAVA_HOME的作用及JAVA环境变量配置
CLASSPATH是什么?它的作用是什么? 它是javac编译器的一个环境变量.它的作用与import.package关键字有关.当你写下improt java.util.*时,编译器面对import ...
- POJ2533——Longest Ordered Subsequence(简单的DP)
Longest Ordered Subsequence DescriptionA numeric sequence of ai is ordered if a1 < a2 < ... &l ...
- JavaScript DOM高级程序设计1.3-常见陷阱--我要坚持到底!
区分大小写 单引号双引号 大多数开发人员选择用单引号,因为XTHML要求所有XHTML的属性都必须使用双引号 var html='<h2 class="a">A lis ...