QOJ.ac

QOJ

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

#13220. 气象学

Statistics

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):无特殊限制。

Discussions

About Discussions

The discussion section is only for posting: Editorials, General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues. Submitting multiple issues may cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.