QOJ.ac

QOJ

時間限制: 4 s 記憶體限制: 256 MB 總分: 100

#10945. 光源

统计

在一个形状为简单多边形(即没有自交的闭合折线)的房间内,在点 $(X_c, Y_c)$ 处放置了一个光源。求房间内被照亮部分的面积。

输入格式

输入文件的第一行包含一个整数 $T$ — 测试用例的数量 ($1 \le T < 20$)。每个测试用例的第一行包含两个实数 $X_c$ 和 $Y_c$ — 光源的坐标。下一行包含一个整数 $N$ — 折线的顶点数 ($3 \le N \le 5 \cdot 10^4$)。接下来的 $N$ 行,每行包含折线的一个顶点的坐标 — 两个实数 $X_i$ 和 $Y_i$。所有坐标的小数点后不超过 4 位,且绝对值不超过 1000。保证光源严格位于房间内部。点的坐标按逆时针顺序给出。

输出格式

对于每个测试用例,输出一个实数 — 房间内被照亮部分的面积,要求绝对误差不超过 $10^{-2}$。

样例

输入 1

1
1 2
5
0 0
1 0
1 1
3 3
0 3

输出 1

5.00

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.