standing



2bc*cosA=b^2+c^2-a^2

#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
const double pi=3.1415926535898;//我不明白他为什么会卡精度
int t;
double x1,y,r1,x2,y2,r2,s,a,b,c,k,m,w,p;
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%lf%lf%lf%lf%lf%lf",&x1,&y,&r1,&x2,&y2,&r2);
double d=sqrt((x2-x1)*(x2-x1)+(y2-y)*(y2-y);
if(d>=(r1+r2))//两圆相离
s=pi*r1*r1+pi*r2*r2;
else
if(d<abs(r1-r2))//两圆内含
s=max(pi*r1*r1,pi*r2*r2);
else//两圆相交
{
s=r1*r1*pi+pi*r2*r2;
k=sqrt((x1-x2)*(x1-x2)+(y-y2)*(y-y2)); w=(r1*r1+k*k-r2*r2)/(*r1*k);
p=*acos(w);
s-=((p*r1*r1)/-sin(p)*r1*r1/); w=(r2*r2+k*k-r1*r1)/(*r2*k);
p=*acos(w);
s-=((p*r2*r2)/-sin(p)*r2*r2/);
}
printf("%.3lf\n",s);
}
return ;
}
只要数学学得好代码就打得好
standing的更多相关文章
- Google Code jam Qualification Round 2015 --- Problem A. Standing Ovation
Problem A. Standing Ovation Problem's Link: https://code.google.com/codejam/contest/6224486/dashbo ...
- [C++]Standing Ovation——Google Code Jam 2015 Qualification Round
Problem It’s opening night at the opera, and your friend is the prima donna (the lead female singer) ...
- 【BZOJ5137】Standing Out from the Herd(后缀自动机)
[BZOJ5137]Standing Out from the Herd(后缀自动机) 题面 BZOJ 洛谷 题解 构建广义后缀自动机 然后对于每个节点处理一下它的集合就好了 不知道为什么,我如果按照 ...
- The only person standing in your way is you.
The only person standing in your way is you.唯一阻碍你的人是你自己.
- Where Are You Standing?
/*********************************************************************** * Where Are You Standing? * ...
- 后缀自动机再复习 + [USACO17DEC] Standing Out from the Herd
here:https://oi-wiki.org/string/sam/ 下面转自 KesdiaelKen的雷蒻论坛 来个广义后缀自动机模板题 [USACO17DEC]Standing Out fro ...
- GCJ 2015-Qualification-A Standing Ovation 难度:0
https://code.google.com/codejam/contest/6224486/dashboard#s=p0 肯定把朋友们都设置在第0位,在第i位前面必须至少有i个人鼓掌,所以答案加上 ...
- Standing on Shouder of Giants
Zachary_Fan 如何一步一步用DDD设计一个电商网站(二)-- 项目架构 http://www.cnblogs.com/Zachary-Fan/p/6012454.html HTTP 权威指南 ...
- P4081 [USACO17DEC]Standing Out from the Herd
思路 对所有串建立广义SAM,之后记录SZ,统计本质不同子串时只统计SZ=1的即可 代码 #include <cstdio> #include <algorithm> #inc ...
随机推荐
- java中字节流和字符流的区别
流分类: 1.Java的字节流 InputStream是所有字节输入流的祖先,而OutputStream是所有字节输出流的祖先.2.Java的字符流 Reader是所有读取字符串输入流的祖先,而 ...
- SRM 207 Div II Level Two: RegularSeason,字符串操作(sstream),多关键字排序(操作符重载)
题目来源:http://community.topcoder.com/stat?c=problem_statement&pm=2866&rd=5853 主要是要对字符串的操作要熟悉,熟 ...
- 单件模式Singleton来控制窗体被重复或多次打开
本文转载:http://blog.csdn.net/a0700746/article/details/4473796 一般在百度搜一下,会出来一下内容,看来很好用.Singleton很方便的一个用处就 ...
- C++ | 调试 · 从汇编代码看i++和++i的区别
以int类型为例 C++编译器为++i生成的代码是 013E1375 mov eax,dword ptr [i] 013E1378 add eax, 013E137B mov dword ptr [i ...
- Another app is currently holding the yum lock; waiting for it to exit... 怎么解决
Another app is currently holding the yum lock; waiting for it to exit... 怎么解决 这个问题说明你的程序yum程序正在运行,必须 ...
- 超级钢琴 2010年NOI
/* 自己yy的奇葩做法居然A了23333 不过空间好像很大 时间好像略慢..... 毕竟不是正解 前缀维护sum值 枚举区间起点 然后终点的坐标可以确定在一个范围 可持久化线段树查询区间第1大 然后 ...
- MySQL数据库中,使用游标循环遍历
/*对*dt库下的所有数据表删除docuemttype为空和documenttype为MD,PD,ET的数据:delete from 表名 where length(documenttype)< ...
- xmpp发送文件
xmpp 文件传输协议: XEP-0096: SI File Transfer:文件传输流初始化协议 XEP-0065: SOCKS5 Bytestreams:带外socks5代理字节流传输协议 XE ...
- Swift - 09 - Optionals
//: Playground - noun: a place where people can play import UIKit // swift中没有被赋值的变量是不能被使用的 //var str ...
- JavaScript验证身份证号
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncodin ...