QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100

#13220. 气象学

统计

zzq 正在写渲染器,他设置了如下场景:在( $x_{1}, y_{1}, z_{1}$ )处有一个点光源,( $x_{2}, y_{2}, z_{2}$ )处有一个半径为 $r$ 的球,有一个由 $a x+b y+c z+d=0$ 描述的平面。保证球、点光源、平面两两不交(交点集为空)。

为了检验渲染器写的是否正确,他需要求出这个平面中被球遮挡而形成的阴影面积。zzq 保证这个值大于 0 且有限。你的输出需要和标准输出绝对误差或相对误差不超过 $10^{-6}$ 。

Input

第一行一个正整数 $T$ ,表示数据组数。 接下来 $T$ 行每行由空格分隔的整数 $x_{1}, y_{1}, z_{1}, x_{2}, y_{2}, z_{2}, r, a, b, c, d$ 。

Output

输出 $T$ 行,每行一个小数表示阴影面积。

Example

Input

4
0 0 5 0 0 2 1 0 0 1 1
2 3 6 0 0 2 2 1 1 10 30
8 7 6 5 4 3 2 1 0 1 2
9 9 9 5 5 5 4 3 2 1 0

Output

14.1371669412
88.0769231962
147.2623403467
469.7668717193

对于第一组数据,可以证明阴影面积为 $4.5 \pi$ 。

对于第二组数据,渲染图如下。求的就是黑色阴影的面积。

problem_13220_1.jpg

Notes

$\left|x_{1}\right|,\left|y_{1}\right|,\left|z_{1}\right|,\left|x_{2}\right|,\left|y_{2}\right|,\left|z_{2}\right|,|a|,|b|,|c|,|d| \leq 10^{4}, 1 \leq r \leq 10^{4}, 1 \leq T \leq 30$ 。

  • Subtask 1 (30pts):$x_{1}=y_{1}=x_{2}=y_{2}=0, a=b=d=0, c=1$ 。
  • Subtask 2 (30pts):$x_{1}=x_{2}=0, a=b=d=0, c=1$ 。
  • Subtask 3 (20pts):$a=b=d=0, c=1$ 。
  • Subtask 4 (20pts):无特殊限制。
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.