Agent J (for the area of three round circumference)

Source: Internet
Author: User

A-a Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%LLD &%llusubmit Status Practice Lightoj 1331

Description

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

Here R1, R2 and R3 is 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 was to find the area of this region for Agent J, as he needs to know where he should land to steal t He 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, digits after the decimal point.

Output

For each case, print the case number and the area of the where the-the-diamond piece is located. Error less than 10-6 would 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.451290327

Exercises

For three round area area, pay attention to use acos,asin will be wrong, because sin150 =, sin30 = 1/2; so asin is wrong.

Code:

#include <iostream>#include<cstdio>#include<cmath>#include<cstring>#include<algorithm>using namespacestd;template<typename T, TypeName t1>T Getcos (T1 A, T B, t C) {return(B*b + c*c-a*a)/(2*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;} intMain () {intT; DoubleR1, R2, R3; intKase =0; scanf ("%d", &T);  while(t--) {scanf ("%LF%LF%LF", &r1, &AMP;R2, &R3); DoubleCosa = getcos (R2 + R3, R1 + R2, R1 +R3); DoubleCOSB = Getcos (r1 + R2, R2 + R3, R1 +R3); DoubleCosc = Getcos (r1 + R3, R1 + R2, R2 +R3); DoubleA =ACOs (COSA); Doubleb =ACOs (COSB); Doublec =ACOs (COSC); DoubleAns = Angarea (A, r1 + R2, R1 + R3)-Cirarea (A, R1)-Cirarea (b, R3)-Cirarea (c, R2); printf ("Case %d:%lf\n", ++Kase, ans); }    return 0;}

Agent J (for the area of three round circumference)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.