2814. Cave Explorer

单点时限: 10.0 sec

内存限制: 256 MB

Mike Smith is a man exploring caves all over the world.

One day, he faced a scaring creature blocking his way. He got scared, but in short time he took his knife and then slashed it to attempt to kill it. Then they were split into parts, which soon died out but the largest one. He slashed the creature a couple of times more to make it small enough, and finally became able to go forward.

Now let us think of his situation in a mathematical way. The creature is considered to be a

polygon, convex or concave. Mike slashes this creature straight with his knife in some direction. We suppose here the direction is given for simpler settings, while the position is arbitrary. Then all split parts but the largest one disappears.

Your task is to write a program that calculates the area of the remaining part when the creature is slashed in such a way that the area is minimized.

输入格式

The input is a sequence of datasets. Each dataset is given in the following format:

n

vx vy

x1 y1

. . .

xn yn

The first line contains an integer n, the number of vertices of the polygon that represents the shape of the creature (3 ≤ n ≤ 100). The next line contains two integers vx and vy, where (vx, vy) denote a vector that represents the direction of the knife (-10000 ≤ vx, vy ≤ 10000, vx2 + vy2 > 0). Then n lines follow. The i-th line contains two integers xi and yi, where (xi, yi) denote the coordinates of the i-th vertex of the polygon (0 ≤ xi, yi ≤ 10000).

The vertices are given in the counterclockwise order. You may assume the polygon is always

simple, that is, the edges do not touch or cross each other except for end points.

The input is terminated by a line with a zero. This should not be processed.

输出格式

For each dataset, print the minimum possible area in a line. The area may be printed with

an arbitrary number of digits after the decimal point, but should not contain an absolute error greater than 10-2.

样例

Input
5
0 1
0 0
5 0
1 1
5 2
0 2
7
9999 9998
0 0
2 0
3 1
1 1
10000 9999
2 2
0 2
10
0 1
10 0
12 2
10 4
12 6
10 8
9 7
10 6
8 4
10 2
9 1
0
Output
2.00
2.2500000
4.0000000000

1 人解决,3 人已尝试。

1 份提交通过,共有 11 份提交。

9.9 EMB 奖励。

创建: 14 年,2 月前.

修改: 6 年,6 月前.

最后提交: 6 年,6 月前.

来源: Japan

题目标签