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 ...
随机推荐
- ubuntu编译openwrt前端web界面
openwrt是由Cisco放出源代码的开放无线路由平台.由于是基于linux内核,所以可以将很多linux平台下的软件移植到此平台下,然后让无线路由拥有很多意想不到的功能,例如拿来做BT下载器,音乐 ...
- Android 4.4(KitKat)中VSync信号的虚拟化
原文地址:http://blog.csdn.net/jinzhuojun/article/details/17293325 Android 4.1(Jelly Bean)引入了Vsync(Vertic ...
- [转]【基于zxing的编解码实战】精简Barcode Scanner篇
通过<[搞定条形码]zxing项目源码解读(2.3.0版本,Android部分)>的分析,现在可以实现最终目标了:精简Barcode Scanner并将其中的编码和解码分离为两个独立的部分 ...
- Cocos2d-X学习——Android移植,使用第三方库.so被删掉问题
2014-05-26 导语:Cocos2dx在安卓上移植的时候,增加第三方库,却发现新加的so库被删掉了. 正文: 1.我的环境: cocos2d-x 2.2.3, ndk-r9 2.网上找了非常多, ...
- [Javascript] Automating Releases with semantic-release
There are so many repeated steps when releasing a new version of a library. The tool semantic-releas ...
- [转] prerender-SPA程序的SEO优化策略
随着web2.0的兴起,ajax的时代已经成为了事实,更如今 Knockout,backbone, angular,ember前端MDV(model driver view)框架强势而来,Single ...
- select poll epoll三者之间的比较
一.概述 说到Linux下的IO复用,系统提供了三个系统调用,分别是select poll epoll.那么这三者之间有什么不同呢,什么时候使用三个之间的其中一个呢? 下面,我将从系统调用原型来分析其 ...
- yii2 and short_open_tag
在看yii2的时候, 在main文件里看到了这样一段代码 <?= Yii::$app->language ?> 而我查看了php.ini里的配置, short_open_tag=Of ...
- Could not fetch https://api.github.com/repos/RobinHerbots/jquery
使用 composer 安装YII2时, 如题所示提示, 原因是由于yii安装中, 需要有一些相关的认证[或许说是composer的认证], 如有如下提示 Could not fetch https: ...
- Python之路,Day14 - It's time for Django
Python之路,Day14 - It's time for Django 本节内容 Django流程介绍 Django url Django view Django models Django ...