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 ...
随机推荐
- zoj 3620 Escape Time II dfs
题目链接: 题目 Escape Time II Time Limit: 20 Sec Memory Limit: 256 MB 问题描述 There is a fire in LTR ' s home ...
- 分享SCI写作经验和一些工具
- spoj 338
题意: 无向图 每条边有长度和费用两个属性 求从点1到点n 在花费不超过 k 的情况下的最短路径 BFS 使用优先队列 长度短的优先出列 题解上的方法没看懂 不知道怎么用链表维护 . ...
- uva 10534
一开始WA了 参考了一下 求正反两个方向的最长上升子序列 并分别记录在两个数组中 最后求最大值 #include <iostream> #include <cstdio&g ...
- Android ListView相关 fastScrollEnabled
1.android:fastScrollEnabled="true" 当数据量比较多的时候,右侧会出现一个可以拉动的滚动条,这样可以很快的拉动,如图:
- nginx配置静态文件服务器
搭建文件服务器 要点就是root目录,会自动指向索引文件 如: index, index.html等 server { client_max_body_size 4G; listen 80; ## l ...
- Android:Toast简单消息提示框
Toast是简单的消息提示框,一定时间后自动消失,没有焦点. 1.简单文本提示的方法: Toast.makeText(this, "默认的toast", Toast.LENGTH_ ...
- 关于JavaScript中的setTimeout()链式调用和setInterval()探索
http://www.cnblogs.com/Wenwang/archive/2012/01/06/2314283.html http://www.cnblogs.com/yangjunhua/arc ...
- linux netcat命令
netcat是网络工具中的“瑞士军刀”,它能通过TCP和UDP在网络中读写数据.通过与其他工具结合和重定向,你可以在脚本中以多种方式使用它.使用netcat命令所能完成的事情令人惊讶. netcat所 ...
- CSS那些事儿-阅读随笔3(清除浮动)
浮动主要是由浮动(float)属性导致的页面错位现象,清除浮动不仅能解决页面错位的现象,还可以解决子元素浮动导致父元素背景无法自适应子元素高度的问题.在CSS样式中,主要利用clear属性中的both ...