7469: Anti-AK Problem

内存限制:128 MB 时间限制:20 S
题面:传统 评测方式:文本比较 上传者:
提交:0 通过:0

题目描述

Zhang3 and Aunt are playing with tomatoes. They throw tomatoes onto a sphere. The center of the sphere is at (0,0,0), and the radius is R. Each time a tomato is thrown, it will burst on the surface of the sphere, then the tomato juice will cover a certain circle on the surface of the sphere, which is called a spherical circle for short. A spherical circle can be represented as (x,y,z,r), where (x,y,z) is the center, a point on the surface, and r is the radius, which is the spherical distance between center and border of the circle. Those points on the surface whose spherical distance to center (x,y,z) is not greater than r are in the circle. (As you know, the spherical distance between two points on the surface is the shortest distance to travel from one to another, passing through only points on the surface of the sphere.) Zhang3 has already thrown n tomatoes, the ith of which covered a spherical circle (xi,yi,zi,ri) with tomato juice.
Aunt decides to throw an extra tomato. She will randomly choose a point on the surface of the sphere, called (x,y,z), and then let tomato juice cover a spherical circle (x,y,z,r0), where r0 is given. Zhang3 wants to know the expected area which is covered by tomato juice at least once. Please calculate and print the value.

输入格式

The first line of the input gives the number of test cases, T (1 ≤ T ≤ 10). T test cases follow. For each test case, the first line contains three numbers n,R,r0 (1 ≤ n ≤ 5000,1 ≤ R ≤ 10), representing the number of tomatoes thrown by Zhang3, the radius of the sphere, and the radius of the random spherical circle, respectively. Then n lines follow, the ith of which contains four real numbers xi,yi,zi,ri, representing the ith spherical circle.
The sum of n in all test cases doesn’t exceed 10000.
For every real number in the input, the decimal part is not longer than 25 digits. The center of each spherical circle, i.e. (xi,yi,zi), has a distance of at most 10−20 to the surface of the sphere. Formally, |(xi,yi,zi)|∈ [R−10−20,R + 10−20]. No spherical circle can be as large as half the sphere. Formally, 0.001πR ≤ r0,ri ≤ 0.499πR.

输出格式

For each test case, print a line with a real number, representing the answer. Your answers should have absolute or relative errors of at most 10−9.

输入样例 复制

1
2 1 0.1
0 0 1 1.5
0 1 0 1.4

输出样例 复制

8.65419601623420079589