A - A

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu

Description

Agent J is preparing to steal an antique diamond piece from a museum. As it is fully guarded and they are guarding it using high technologies, it's not easy to steal the piece. There are three circular laser scanners in the museum which are the main headache for Agent J. The scanners are centered in a certain position, and they keep rotating maintaining a certain radius. And they are placed such that their coverage areas touch each other as shown in the picture below:

Here R1R2 and R3 are the radii of the coverage areas of the three laser scanners. The diamond is placed in the place blue shaded region as in the picture. Now your task is to find the area of this region for Agent J, as he needs to know where he should land to steal the diamond.

Input

Input starts with an integer T (≤ 1000), denoting the number of test cases.

Each case starts with a line containing three real numbers denoting R1, R2 and R3 (0 < R1, R2, R3 ≤ 100). And no number contains more than two digits after the decimal point.

Output

For each case, print the case number and the area of the place where the diamond piece is located. Error less than 10-6 will be ignored.

Sample Input

3

1.0 1.0 1.0

2 2 2

3 3 3

Sample Output

Case 1: 0.16125448

Case 2: 0.645017923

Case 3: 1.4512903270

题解:

求三个圆围成的区域面积,注意要用acos,asin会出错,因为sin150 = 1/2, sin30 = 1/2;这样asin就出错了。。

代码:

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
template<typename T, typename T1>
T getcos(T1 a, T b, T c){
return (b*b + c*c - a*a) / (*b*c);
}
template<typename T>
T Angarea(T a, T b, T c){
return 0.5 * b * c * sin(a);
}
template<typename T>
T cirarea(T a, T r){
return 0.5 * a * r * r;
} int main(){
int T;
double r1, r2, r3;
int kase = ;
scanf("%d", &T);
while(T--){
scanf("%lf%lf%lf", &r1, &r2, &r3);
double cosa = getcos(r2 + r3, r1 + r2, r1 + r3);
double cosb = getcos(r1 + r2, r2 + r3, r1 + r3);
double cosc = getcos(r1 + r3, r1 + r2, r2 + r3);
double a = acos(cosa);
double b = acos(cosb);
double c = acos(cosc);
double ans = Angarea(a, r1 + r2, r1 + r3) - cirarea(a, r1) - cirarea(b, r3) - cirarea(c, r2);
printf("Case %d: %lf\n", ++kase, ans); }
return ;
}
 

Agent J(求三个圆围成的区域面积)的更多相关文章

  1. HDU 1071 The area(求三个点确定的抛物线的面积,其中一个点是顶点)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1071 The area Time Limit: 2000/1000 MS (Java/Others)  ...

  2. 求曲线y=lnx在区间(2,6)内的一条切线,使得该切线与直线x=2,x=6及曲线y=lnx所围成的图形的面积最小。

    求曲线y=lnx在区间(2,6)内的一条切线,使得该切线与直线x=2,x=6及曲线y=lnx所围成的图形的面积最小. 1.先画图. 2.设切点为(a,lna) (2<a<6) 3.切线方程 ...

  3. uva11178 Morley’s Theorem(求三角形的角三分线围成三角形的点)

    Morley’s Theorem Input: Standard Input Output: Standard Output Morley’s theorem states that that the ...

  4. 多个n维向量围成的n维体积的大小

    前言 上周我们数学老师给了我们一道题,大意就是两个向量a和b,一个点M=$x*a+y*b$,x,y有范围,然后所有M组成的面积是一个定值,求x+y的最小值.当然这是道小水题,但我在想,如果把两个向量变 ...

  5. CodeForces 8D Two Friends 判断三个圆相交

    题意: 有两个人\(Alan\)和\(Bob\),他们现在都在\(A\)点,现在\(Bob\)想去\(B\)点,\(Alan\)想先到\(C\)点再去\(B\)点. \(Alan\)所走的总路程不能超 ...

  6. LeetCode 85 | 如何从矩阵当中找到数字围成的最大矩形的面积?

    本文始发于个人公众号:TechFlow,原创不易,求个关注 今天是LeetCode专题53篇文章,我们一起来看看LeetCode中的85题,Maximal Rectangle(最大面积矩形). 今天的 ...

  7. HDU 3467 (求五个圆相交面积) Song of the Siren

    还没开始写题解我就已经内牛满面了,从晚饭搞到现在,WA得我都快哭了呢 题意: 在DotA中,你现在1V5,但是你的英雄有一个半径为r的眩晕技能,已知敌方五个英雄的坐标,问能否将该技能投放到一个合适的位 ...

  8. codeforces 8D Two Friends 二分+ 判断三个圆是否有公共交点

    题目链接 有两个人x, y, 现在在A点, x要直接去B点, y要先去C点在去B点, 现在给出x, y两人可以行走的最大距离T1, T2, 求出他们从A点出发之后, 可以走的最长的公共路径. 我们先看 ...

  9. poj3819 Coverage (求直线与圆的交占直线的百分比 )

    题意:给你一条直线和若干个圆,求圆与直线相交的长度占整条直线的比例 解题思路:通过定比分点的方法求出圆与直线的交占圆的比例. 第一步:(确定投影的方向是x轴还是y轴) (1)当直线的line.s(x, ...

随机推荐

  1. c#调用Excel绘制图表

    c#调用Excel需要引用命名空间 using Microsoft.Office.Interop.Excel; 由于该程序不复杂,主要是根据不同数据画表和图,画的图像也并不复杂,因为画图和画表的操作会 ...

  2. [置顶] 【cocos2d-x入门实战】微信飞机大战之十二:分数的本地存储

    转载请表明地址:http://blog.csdn.net/jackystudio/article/details/12036237 作为一个单机游戏,连分数存储的的功能都没有,让它怎么在单机游戏圈里混 ...

  3. Swift——(一)为Swift内置类型加入属性

    在看苹果官方的Swift Language的时候,遇到实验:Write an extension for the Double type that add an absoluteValue prope ...

  4. css1-颜色和长度

    <!DOCTYPE html>CSS1-颜色和长度 <style>div{ /*颜色*/ color:#f00; /*前景色*/ background:#00f; /*背景色* ...

  5. html进阶css(5)

    css定位机制 css有三种基本的定位机制:普通流,浮动和绝对定位. 除非专门指定,否则所有框都在普通流中定位.也就是说,普通流中的元素的位置由元素在html中的位置决定. 块级框从上到下一个接一个的 ...

  6. MVC View基础(转)

    View主要用于呈现数据.由于Controller和相关的Service已经处理完业务逻辑并将结果打包成model实体,View只需要怎么去获得model并将其转为Html 1选择需要渲染的视图 在上 ...

  7. UIDeviceOrientation UIInterfaceOrientation 区别

    UIDeviceOrientation      是机器硬件的当前旋转方向   这个你只能取值 不能设置 UIInterfaceOrientation   是你程序界面的当前旋转方向   这个可以设置 ...

  8. POJ 1269 - Intersecting Lines 直线与直线相交

    题意:    判断直线间位置关系: 相交,平行,重合 include <iostream> #include <cstdio> using namespace std; str ...

  9. 莫比乌斯反演题目泛做(为了对应smz的课件)

    题1:BZOJ2190 SDOI 2010 仪仗队 题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2190 算法讨论: 我们先来考虑一个点被 ...

  10. jquery判断表单提交是否为空

    <input type="text" value="" name="toPage"> 判断该表单是否为空 var p = $(& ...