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 ...
随机推荐
- CLOSE-UP FORMALWEAR_意大利进口_2015秋冬_男装发布会_西装图片系列_男装西装设计资料_WeArTrends时尚资讯网_国内最专业的服装设计资讯网站
CLOSE-UP FORMALWEAR_意大利进口_2015秋冬_男装发布会_西装图片系列_男装西装设计资料_WeArTrends时尚资讯网_国内最专业的服装设计资讯网站 CLOSE-UP FORMA ...
- shell 二元操作符 =~
17:14 [logc@a005.client.hadoop.qingdao.youku]$ a=1 17:14 [logc@a005.client.hadoop.qingdao.youku]$ if ...
- 布隆过滤器的java实现
package com.kaikeba.data.jobspider.util; import java.util.BitSet; public class Bloomfilter { private ...
- HTML5 骨架
html: <!DOCTYPE html> <html lang="zh-CN"> <head> <title>HTML5 骨架&l ...
- jsp判断手机访问和电脑访问
<% //取用户操作系统信息 String agent = request.getHeader("User-Agent") == null ? "": r ...
- Hard 随机选择subset @CareerCup
算法同上题 package Hard; import CtCILibrary.AssortedMethods; /** * Write a method to randomly generate a ...
- [Angular 2] The form export from NgFormControl
In last post, we need to create an instanse variable: sku: AbstructControl; We can get rid of this b ...
- [Angular 2] NgNonBindable
If you want to print someting like {{content}} on the html, using ng-non-bindable directive: <div ...
- STL——前闭后开区间表示法和function call 操作符
前开后闭开区间表示法[) 任何一个STL算法,都需要获得由一对迭代器(泛型指针)所标示的区间,用以表示操作范围,这一对迭代器所标示的是个所谓的前闭后开区间,以[first,last)表示,也就是说,整 ...
- android studio c++ 自动补全
这两天弄起来了Android ndk,可这东西的配置实在是个问题.对于Eclipse可以通过makefile进行编译,也比较成熟.但是对Android studio来说就蛋疼了,官方是想通过gradl ...