问题 4472 --(2005广东省赛) 多边形旋转

4472: (2005广东省赛) 多边形旋转

时间限制: 1 Sec  内存限制: 256 MB
提交: 0  解决: 0
[提交][状态][讨论版][命题人:]

题目描述

Given a convex polygon with N vertices p[1],...,p[N] and a line L on a 2-Dimensional plane. You can generate a 3-Dimensional solid of revolution by the revolution of the convex polygon around the axis L. Now your mission is to calculate the volume of this solid. When the axis L is an external line of the convex polygon, it’s much easier, because the following theorem will help you. But now, be careful, the axis may intersect the convex polygon. The second theorem of Pappus: The volume V of a solid of revolution generated by the revolution of a lamina about an external axis is equal to the product of the area A of the lamina and the distance traveled by the lamina's geometric centroid.

输入

The first line of the input is a positive integer T, denoting the number of test cases followed. The first line of each test case is a positive integer N (2

输出

The output should consist of T lines, one line for each test case, only containing one real number which represents the volume V of the solid of revolution, exact to one decimal after the decimal point. No redundant spaces are needed.

样例输入

2
4
0 0
0 1
1 1
1 0
1 0 0
4
0 0
0 1
1 1
1 0
2 0 -1

样例输出

3.1
0.8

来源

[提交][状态]