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

 #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. Matlab实现ItemBasedCF算法

    感谢开源大神,慢慢收集资料.网上资料很少,我在找如何用matlab处理movielens数据集时找到的. 用ml-100k这个数据集,包括主函数和相似度函数. 代码托管于CSDN.

  2. Git管理unity3d项目

    如果小组中没有足够的专业版license,用不了unity3d自带的version control,可以使用git来对项目进行版本控制:只不过需要建一个.gitignore文件在git项目管理的根目录 ...

  3. UIViewController中各方法调用顺序及功能详解

    UIViewController中各方法调用顺序及功能详解 UIViewController中loadView, viewDidLoad, viewWillUnload, viewDidUnload, ...

  4. java:I/O 一行一行读取和写入

    BufferedReader逐行读取 import java.io.*; class Test { public static void main(String args []){ FileReade ...

  5. Tomcat 部署Undeployment Failure

    Tomcat 部署Undeployment Failure - yongjava的日志 - 网易博客 http://blog.163.com/qiangyongbin2000@126/blog/sta ...

  6. swap chain- IDirect3DSwapChain9

    交换链,对应的接口是IDirect3DSwapChain9,是整个Directx 3D中最核心的接口.D3d程序至少包含一个swap chain,在调用CreateDevice时自动创建, 其中的D3 ...

  7. Java SE7新特性之try-with-resources语句

       try-with-resources语句是一个声明一个或多个资源的 try 语句.一个资源作为一个对象,必须在程序结束之后随之关闭. try-with-resources语句确保在语句的最后每个 ...

  8. Linux的分段和分页机制

    1.分段机制 80386的两种工作模式  80386的工作模式包括实地址模式和虚地址模式(保护模式).Linux主要工作在保护模式下. 分段机制  在保护模式下,80386虚地址空间可达16K个段,每 ...

  9. node.js模块之Buffer模块

    http://nodejs.org/api/buffer.html Pure JavaScript is Unicode friendly but not nice to binary data. W ...

  10. Ubuntu忘记管理员密码

    Ubuntu中不小心把管理员密码忘记了,真叫人头大. 现提供一个解决方案: 1.重启 Ubuntu 系统,按 Esc 进入GRUB 菜单界面,如下图: 2.选择recovery mode. (第二个) ...