QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 512 MB Puntuación total: 100

#11084. 盘旋的大黄蜂

Estadísticas

你成功地将一只大黄蜂困在了餐桌上的一个盒子里。不幸的是,你的骰子也被困在里面了——你无法取回它并继续你的大富翁游戏,否则就会冒着激怒大黄蜂的风险。于是,你打发时间计算大黄蜂能看到的骰子点数的期望值。

大黄蜂、骰子和盒子位于标准三维坐标系中,其中 $x$ 轴向东延伸,$y$ 轴向北延伸,$z$ 轴向上延伸。桌子的表面对应于 $x-y$ 平面。

第二个样例输入的透视图和鸟瞰图

骰子是一个 $1 \times 1 \times 1$ 的立方体,静止在桌面上,底面的中心恰好位于原点。因此,其两个相对顶点的坐标为 $(-0.5, -0.5, 0)$ 和 $(0.5, 0.5, 1)$。骰子的顶面有 5 个点,南面有 1 个点,东面有 3 个点,北面有 6 个点,西面有 4 个点,底面(不可见且无关紧要)有 2 个点。

盒子是一个 $5 \times 5 \times 5$ 的立方体,也静止在桌面上,骰子位于其内部。盒子通过给出其底面的坐标(一个 $5 \times 5$ 的正方形)来指定。

假设大黄蜂悬停在盒子内部(不被骰子占据的连续空间)的一个均匀随机点上。计算大黄蜂能看到的点数的期望值。骰子是不透明的,因此,只有当连接点中心与大黄蜂位置的线段不与骰子内部相交时,大黄蜂才能看到该点。

输入格式

输入包含 4 行。第 $k$ 行包含两个浮点数 $x_k$ 和 $y_k$ ($-5 \le x_k, y_k \le 5$),表示盒子底面第 $k$ 个顶点的 $x-y$ 平面坐标。坐标按逆时针方向给出,它们描述了一个边长恰好为 5 的正方形。

盒子完全包含骰子。盒子和骰子的表面除了底面外不相交或接触。

输出格式

输出一个浮点数,表示可见点数的期望值。如果结果与标准答案的绝对误差或相对误差小于 $10^{-6}$,则该解将被接受。

样例

输入 1

-2.5 -1.5
2.5 -1.5
2.5 3.5
-2.5 3.5

输出 1

10.6854838710

输入 2

3 0
0 4
-4 1
-1 -3

输出 2

10.1226478495

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.