QOJ.ac

QOJ

時間限制: 12 s 記憶體限制: 1024 MB 總分: 25

#5753. 苍蝇拍

统计

用网球拍击中苍蝇的概率是多少?

首先,忽略球拍的柄。假设球拍是一个完美的圆环,外半径为 $R$,厚度为 $t$(因此圆环的内半径为 $R-t$)。

圆环上覆盖着横向和纵向的弦。每根弦都是一个半径为 $r$ 的圆柱体。每根弦都是圆环的一条弦(连接圆上两点的直线)。相邻弦之间的间隙长度为 $g$。这些弦关于球拍中心对称,即存在一对弦,它们的中心在圆环中心相交。

苍蝇是一个半径为 $f$ 的球体。假设球拍正沿着垂直于圆环平面的直线运动。同时假设苍蝇的中心位于球拍外半径之内,且在圆环半径范围内的任何位置出现的概率相等。苍蝇与球拍(圆环或弦)之间的任何重叠都算作击中。

输入格式

第一行包含一个整数 $N$,表示输入文件中的测试用例数量。

接下来的 $N$ 行,每行包含由一个空格分隔的数字 $f$、$R$、$t$、$r$ 和 $g$。这些数字小数点后均有 6 位。

输出格式

输出 $N$ 行,每行格式为 "Case #$k$: $P$",其中 $k$ 是测试用例的编号,$P$ 是用球拍击中苍蝇的概率。

相对误差或绝对误差不超过 $10^{-6}$ 的答案将被视为正确。

数据范围

$f$、$R$、$t$、$r$ 和 $g$ 均为正数且小于等于 $10000$。

$t < R$

$f < R$

$r < R$

小数据(测试集 1 - 可见;5 分)

$1 < N < 30$

弦的总数最多为 60(即每个方向最多 30 根)。

大数据(测试集 2 - 隐藏;20 分)

$1 < N < 100$

弦的总数最多为 2000(即每个方向最多 1000 根)。

样例

样例输入 1

5
0.250000 1.000000 0.100000 0.010000 0.500000
0.250000 1.000000 0.100000 0.010000 0.900000
0.000010 10000.000000 0.000010 0.000010 1000.000000
0.400000 10000.000000 0.000010 0.000010 700.000000
1.000000 100.000000 1.000000 1.000000 10.000000

样例输出 1

Case #1: 1.000000
Case #2: 0.910015
Case #3: 0.000000
Case #4: 0.002371
Case #5: 0.573972

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.