Cover the Polygon with Your Disk
题号:NC207728
时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

A convex polygon is drawn on a flat paper sheet. You are trying to place a disk in your hands to cover as large area of the polygon as possible. In other words, the intersection area of the polygon and the disk should be maximized.

输入描述:

The input consists of a single test case, formatted as follows. All input items are integers. 
n r 
x1 y
... 
xn yn 
n is the number of vertices of the polygon (3 ≤ n ≤ 10). r is the radius of the disk (1 ≤ r ≤ 100).xi and yi give the coordinate values of the i-th vertex of the polygon (1 ≤ i ≤ n). Coordinatevalues satisfy 0 ≤ xi ≤ 100 and 0 ≤ yi ≤ 100.The vertices are given in counterclockwise order. As stated above, the given polygon is convex.In other words, interior angles at all of its vertices are less than 180◦. Note that the border ofa convex polygon never crosses or touches itself.

输出描述:

Output the largest possible intersection area of the polygon and the disk. The answer shouldnot have an error greater than 0.0001 (10−4 ).
示例1

输入

复制
4 4
0 0
6 0
6 6
0 6

输出

复制
35.759506
示例2

输入

复制
3 1
0 0
2 1
1 3

输出

复制
2.113100
示例3

输入

复制
3 1
0 0
100 1
99 1

输出

复制
0.019798
示例4

输入

复制
4 1
0 0
100 10
100 12
0 1

输出

复制
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

输出

复制
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

输出

复制
7181.603297