Intersection
Time Limit: 4000/4000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 3018 Accepted Submission(s): 1135
Problem Description
Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know.
Input
The first line contains only one integer T (T ≤ 105), which indicates the number of test cases. For each test case, the first line contains two integers r, R (0 ≤ r < R ≤ 10).
Each of the following two lines contains two integers xi, yi (0 ≤ xi, yi ≤ 20) indicating the coordinates of the center of each ring.
Output
For each test case, output a single line “Case #x: y”, where x is the case number (starting from 1) and y is the area of intersection rounded to 6 decimal places.
Sample Input
Sample Output
Source
//题意:问两个同样大的圆环相交的面积是多大
画图后,可以发现,用容斥定理很简单,area = 两个大圆的相交面积 - 2 * 大圆和小圆相交面积 + 两个小圆相交面积
求面积要用余弦定理,然后就简单了
1 #include2 #include 3 #include 4 #include 5 #include 6 #include 7 #include