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 ...
随机推荐
- ssh非交互式密码输入
ssh登陆不能在命令行中指定密码.sshpass的出现,解决了这一问题.sshpass用于非交互SSH的密码验证,一般用在sh脚本中,无须再次输入密码. 它允许你用 -p 参数指定明文密码,然后直接登 ...
- AGG 之贝塞尔插值
原文: http://liyiwen.iteye.com/blog/705489 之前 comp.graphic.algorithms 上有一个讨论,是关于怎么样使用曲线对多边形进行插值处理,使得最终 ...
- FC和SCSI
IDE(Integrated Drive Electronics)即"电子集成驱动器",它的本意是指把"硬盘控制器"与"盘体"集成在一起的硬 ...
- HTML embed标签使用方法和属性详解
一.基本语法 代码如下: embed src=url 说明:embed可以用来插入各种多媒体,格式可以是 Midi.Wav.AIFF.AU.MP3等等,Netscape及新版的IE 都支持 ...
- Windows环境下python多版本配置方案
系统环境 Windows,安装了msys2,windows和msys2都安装了python,且版本比较多,使用shell/bash聚合工具conemu64 配置方案 配置msys2环境用户目录下的.b ...
- Jquery AJAX 调用WebService服务
对Jquery+JSON+WebService的一点认识 文章不错:http://www.cnblogs.com/tyb1222/archive/2011/10/13/2210549.html Jqu ...
- configure JAAS for jboss 7.1 and mysql--reference
Hello all, In this tutorial we are going to configure JAAS for jboss 7.1 and mysql for Form based au ...
- TCP/IP协议原理与应用笔记10:TCP/IP协议族
1. 协议族视图如下:(这里我们列举重要的,并不是所有的) (1)网络接入层(数据链路层 和 物理层): 通过接入的物理网络的 功能 和 覆盖范围 进行分析划分为: •LANs :局域网(Local ...
- Android真正意义上的无限轮播Banner
在android开发的时候,经常会使用到轮播图,对于这种效果,一般情况下,我们都会使用一种叫做ViewPager的来实现. 传统的实现逻辑是自定义一个View继承ViewPager,在适配器中 将co ...
- Linux开发工具之gdb(下)
三.gdb调试(下) 01.查看运行时数据 print - 查看变量值 ptype - 查看类型 print array - 查看数组 print *array@len - 查看动态内存 print ...