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

Chika and Solid Geometry

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 140    Accepted Submission(s): 29
Special Judge


Problem Description
Chika has just learned about solid geometry! She is very interested in the volume of three-dimensional geometric shapes, so she decides to test you.
Before that, she is going to tell you definitions of the following two three-dimensional geometric shapes.

Oblique circular cone: A cone whose surface is generated by lines joining a fixed point called the apex to the points of a circle, the fixed point lying on a line that is not perpendicular to the circle at its center. (The circular cone is a special kind of oblique circular cone.)



Pyramid: A polyhedron formed by connecting a polygonal base and a point, called the apex. Each base edge and apex form a triangle, called a lateral face. It is a conic solid with polygonal base. A pyramid with an n-sided base has $n + 1$ vertices, $n + 1$ faces, and $2n$ edges.



Chika gives you an oblique circular cone and a pyramid placed in the space rectangular coordinate system. Their bottoms are on the plane $z=0$. The $z$-coordinates of their apexes are bigger than $0$. Some parts of them may overlap with each other. You need to help Chika to calculate the volume of the union of the two three-dimensional geometric shapes.
 

Input
The input file contains several lines.
The first line contains three integers $x$, $y$, $z$ $(z > 0)$, which are the coordinates of the apex of the oblique circular cone.
The second row contains three integers $x$, $y$ and $r$ $(r > 0)$. $x$ and $y$ are the $x$-coordinate and the $y$-coordinate of the center of the oblique circular cone's bottom circle. $r$ is radius of the oblique circular cones's bottom circle.
The third line contains three integers $x$, $y$, $z$ $(z > 0)$, which are the coordinates of the apex of the pyramid.
The fourth line contains a positive integer $n$ $(n \leq 1000)$, which is the number of vertices of the pyramid's bottom polygon.
Then $n$ lines follow. Each line contains two integers $x$, $y$, which are the $x$-coordinate and $y$-coordinate of the $n$ vertices of the pyramid's bottom polygon. Vertex coordinates are given in counterclockwise order. These points do not coincide.
It is guaranteed that the absolute values of all input integers are not greater than $1000$.
 

Output
The output file should contain only one line, including one real number, representing the volume of the union of the oblique circular cone and the pyramid. The relative error or absolute error between your answer and the standard answer should be less than $10^{-6}$.
 

Sample Input
0 0 2 2 0 2 0 0 2 3 2 0 4 -2 4 2
 

Sample Output
8.9498519738
 

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-11-23 08:40:24, Gzip enabled