QOJ.ac

QOJ

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

#2948. 缩减

Statistics

著名核物理学家 Adam Szmasczer 找到了解决全球人口过剩和资源匮乏的方法:缩小一切!更准确地说,他找到了一种将空间区域(无论是有界还是无界)传送到有限球形单元内有界点集的方法。他解释了其过程如下(为简化起见,下文仅在二维空间中讨论)。

假设一个半径为 $r$ 的圆形单元以点 $O$ 为中心。设 $P$ 为圆内区域之外的任意点,并假设直线 $OP$ 与该单元的边界交于点 $B$。随后,点 $P$ 被传送到该直线上的一点 $P'$,满足 $\text{length}(OP) \cdot \text{length}(OP') = r^2$。(位于单元边界上的点传送后保持不变。)图 D.1 展示了一个五边形“房子”是如何被传送到圆内阴影区域的;图中标识了样本点 $O$、$P$、$P'$ 和 $B$ 以说明传送规则。

图 D.1:样例输入 1,说明缩小过程

给定一个不包含该单元内部任何点的凸多边形形状,Adam 想知道对应传送后的形状的面积。你能帮帮他吗?

输入格式

输入的第一行包含三个整数 $x_0, y_0$ 和 $r$,$-10^4 \le x_0, y_0, r \le 10^4$,指定了圆形单元的中心及其半径。(整个圆形单元位于指定的范围内。)输入的第二行包含一个正整数 $n$,$3 \le n \le 100$,随后是 $n$ 对整数 $x_1, y_1, x_2, y_2, \dots, x_n, y_n$,$-10^4 \le x_i, y_i \le 10^4$,给出了一个以逆时针顺序排列的 $n$ 边形凸多边形的顶点。

输出格式

输出输入中对应多边形形状传送后在单元内所占区域的面积。你的答案应精确到相对或绝对误差 $10^{-6}$ 以内。

样例

输入格式 1

3 3 5
5 11 9 9 6 9 1 13 1 13 6

输出格式 1

4.112904

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.