QOJ.ac

QOJ

时间限制: 3 s 内存限制: 512 MB 总分: 100

#182. 用圆盘覆盖多边形

统计

一张平整的纸上画有一个凸多边形。你试图在手中放置一个圆盘,以覆盖尽可能大的多边形面积。换句话说,需要使多边形与圆盘的交集面积最大化。

输入格式

输入包含一个测试用例,格式如下。所有输入项均为整数。

$n$ $r$ $x_1$ $y_1$ $\vdots$ $x_n$ $y_n$

$n$ 是多边形的顶点数 ($3 \le n \le 10$)。$r$ 是圆盘的半径 ($1 \le r \le 100$)。$x_i$ 和 $y_i$ 给出了多边形第 $i$ 个顶点的坐标值 ($1 \le i \le n$)。坐标值满足 $0 \le x_i \le 100$ 且 $0 \le y_i \le 100$。

顶点按逆时针顺序给出。如上所述,给定的多边形是凸的。换句话说,其所有顶点的内角均小于 $180^\circ$。注意,凸多边形的边界不会自交或接触。

输出格式

输出多边形与圆盘交集的最大可能面积。答案的误差不应超过 $0.0001$ ($10^{-4}$)。

样例

输入 1

4 4
0 0
6 0
6 6
0 6

输出 1

35.759506

输入 2

3 1
0 0
2 1
1 3

输出 2

2.113100

输入 3

3 1
0 0
100 1
99 1

输出 3

0.019798

输入 4

4 1
0 0
100 10
100 12
0 1

输出 4

3.137569

输入 5

10 10
0 0
10 0
20 1
30 3
40 6
50 10
60 15
70 21
80 28
90 36

输出 5

177.728187

输入 6

10 49
50 0
79 10
96 32
96 68
79 90
50 100
21 90
4 68
4 32
21 10

输出 6

7181.603297

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.