题意:求相交圆的面积。借鉴大神代码,精度超高。

 #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的更多相关文章

  1. codeforces 600D Area of Two Circles' Intersection

    分相离,内含,想交三种情况讨论一下. 主要是精度和数据范围的问题,首先数据用long double,能用整型判断就不要用浮点型. 题目中所给的坐标,半径是整型的,出现卡浮点判断的情况还是比较少的. 最 ...

  2. 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 ...

  3. codeforces 几道题目

    BZOJ挂了....明天就要出发去GDKOI了....不能弃疗. 于是在cf水了几道题, 写写详(jian)细(dan)题解, 攒攒RP, 希望GDKOI能好好发挥.......  620E. New ...

  4. Educational Codeforces Round 2

    600A - Extract Numbers    20171106 字符串处理题,稍微注意点细节就能水过 #include<stdlib.h> #include<stdio.h&g ...

  5. Trilateration三边测量定位算法

    转载自Jiaxing / 2014年2月22日 基本原理 Trilateration(三边测量)是一种常用的定位算法: 已知三点位置 (x1, y1), (x2, y2), (x3, y3) 已知未知 ...

  6. Shape comparison language

      形状比较语言, 九交模型 In this topic About shape comparison language Dimensionality Extensions to the CBM SC ...

  7. HDU 1724 Ellipse(数值积分の辛普森公式)

    Problem Description Math is important!! Many students failed in 2+2’s mathematical test, so let's AC ...

  8. 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 ...

  9. HDU 1724 Ellipse [辛普森积分]

    Ellipse Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Sub ...

随机推荐

  1. DIV中TABLE居的2种方式

    <html><head><title>测试页面</title></head><body><div width=" ...

  2. onClick(View) of type new View.OnClickListener(){} must override a superclass method

    原地址:http://blog.csdn.net/aeolus1019/article/details/8014798 Android开发过程中代码错误报错如下: - implements andro ...

  3. 从零开始运维之旅:如何监控你的 Windows?

    小弟乃刚刚踏入运维圈的资深小白一枚,正所谓完事开头难,公司里怕我把生产系统搞坏就让我先在测试环境上先练练手.巧的是测试环境又是我熟悉的 Windows 环境,心中窃喜啊.但问题随之而来,运维从何下手呢 ...

  4. c++实现文本中英文单词和汉字字符的统计

    源代码下载:http://download.csdn.net/detail/nuptboyzhb/4987141 1.统计文本中汉字的频数,为后续的文本分类做基础.对于汉字的统计,需要判断读取的是否为 ...

  5. ajax返回正个页面

       

  6. hdu 2897 邂逅明下 博弈论

    这个分区间: 1<=n%(p+q)<=p 必败 其他必胜! 代码如下: #include<iostream> #include<stdio.h> #include& ...

  7. codeforces #313 div1 D

    好神的题目! 首先我们运用pick定理A=S-B/2+1将要求的东西转化掉 之后分离变量,我们变成了求选取凸包面积的期望和求选取凸包在边界上的点的期望 我们先考虑求选取凸包面积的期望 如何计算凸多边形 ...

  8. USB Type-C工作原理解析

    自从苹果发布了新MacBook,USB Type-C接口就成为了热议对象.我来从硬件角度解析下这个USB Type-C,以便大家更好的了解USB Type-C的工作原理. 特色 尺寸小,支持正反插,速 ...

  9. 远程唤醒 N54L

    远程唤醒 N54L 我的N54L装了一块买时带的WD500G黑盘,又装了一个WD2T绿盘,存些电影歌曲什么的,当NAS用,装的WIN7系统,长时间不使用就自动关机了,每次都得按一下电源开关键,于是就研 ...

  10. CentOS7.1 安装关键步骤 记录下来

    SecureCRT下载地址 https://yunpan.cn/cS9W94kuvhXPb  访问密码 08cd[这里GNOME桌面 下的 要全选,截屏有误]