QOJ.ac

QOJ

実行時間制限: 3.0 s メモリ制限: 256 MB 満点: 100 ハック可能 ✓

#11314. 圆锥

統計

这是一个简单的几何问题:计算相同圆锥体并集的体积。这些圆锥体位于 $z = 0$ 平面上。位于 $(x_0, y_0, 0)$ 的圆锥体定义为 $\{(x, y, z) \mid 0 \le z \le 1 - \sqrt{(x - x_0)^2 + (y - y_0)^2}\}$。

给定圆锥体的位置 $(x_k, y_k)$,计算这些圆锥体并集的体积。

输入格式

输入的第一行包含测试用例的数量 $T$ ($1 \le T \le 100$)。接下来是 $T$ 个测试用例。

每个测试用例的第一行是一个整数 $N$ ($1 \le N \le 1000$),表示圆锥体的数量,随后有 $N$ 行。每行包含两个小数点后有 4 位数字的实数 $x_k$ 和 $y_k$,表示第 $k$ 个圆锥体的位置,其中 $-20.0 \le x_k, y_k \le 20.0$,且没有两个点重合。

对于至少 90% 的测试用例,保证 $N \le 300$。

输出格式

对于每个测试用例,输出一行,包含 “Case x: y”,其中 $x$ 是测试用例编号(从 1 开始),$y$ 是圆锥体并集的体积。如果你的答案与正确答案的绝对误差或相对误差在 $10^{-6}$ 以内,则被视为正确。

样例

输入 1

4
1
0.0000 0.0000
2
0.0000 0.0000
1.0000 0.0000
3
-4.1850 0.8550
3.8150 4.0400
2.1300 -2.6700
5
5.6422 7.8467
-5.7704 9.1233
-1.2843 5.2843
3.8242 -2.2140
-4.6870 1.8571

输出 1

Case 1: 1.047197551196598
Case 2: 1.863867179374688
Case 3: 3.141592653589793
Case 4: 5.235987755982988

Discussions

About Discussions

The discussion section is only for posting: 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.
  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.