F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Anti-AK Problem

Time Limit: 40000/20000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 19    Accepted Submission(s): 10
Special Judge


Problem Description
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 $i^\mathrm{th}$ of which covered a spherical circle $(x_i, y_i, z_i, r_i)$ 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, r_0)$, where $r_0$ is given.

Zhang3 wants to know the expected area which is covered by tomato juice at least once. Please calculate and print the value.
 

Input
The first line of the input gives the number of test cases, $T \; (1 \le T \le 10)$. $T$ test cases follow.

For each test case, the first line contains three numbers $n, R, r_0 \; (1 \le n \le 5000, 1 \le R \le 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 $i^\mathrm{th}$ of which contains four real numbers $x_i, y_i, z_i, r_i$, representing the $i^\mathrm{th}$ 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. $(x_i, y_i, z_i)$, has a distance of at most $10^{-20}$ to the surface of the sphere. Formally, $|(x_i, y_i, z_i)| \in [R - 10^{-20}, R + 10^{-20}]$.

No spherical circle can be as large as half the sphere. Formally, $0.001 \pi R \le r_0, r_i \le 0.499 \pi R$.
 

Output
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}$.
 

Sample Input
1 2 1 0.1 0 0 1 1.5 0 1 0 1.4
 

Sample Output
8.65419601623420079589
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-20 04:19:14, Gzip enabled