OI Problems   关于

#60v5d7. Piece of Cake

时间限制:1 s       空间限制:1 GiB       标签: 数学 计算几何 2019 

算法难度等级:3       思维难度等级:6       实现难度等级:3


本题来源于:2019-2020 ICPC - North American Invitational Programming Contest 2019 Problem A

  • 简体中文
  • English

给定 nn 个点的凸多边形,随机选 kk 个点,期望面积是多少?

3kn25003\leq k\leq n\leq 2500

样例输入输出

4 3
0 0
1 1
2 1
1 0
0.50000000
5 5
0 4
4 2
4 1
3 -1
-2 4
12.50000000
5 3
-1.20 2.80
3.30 2.40
3.10 -0.80
2.00 -4.60
-4.40 -0.50
12.43300000

Problem Description

Alice received a cake for her birthday! Her cake can be described by a convex polygon with nn vertices. No three vertices are collinear.

Alice will now choose exactly kk random vertices (k3k\geq 3) from her cake and cut a piece, the shape of which is the convex polygon defined by those vertices. Compute the expected area of this piece of cake.

Input

Each test case will begin with a line with two space-separated integers nn and kk (3kn25003\leq k\leq n\leq 2\,500), where nn is the number of vertices of the cake, and kk is the number of vertices of the piece that Alice cuts.

Each of the next nn lines will contain two space-separated real numbers xx and yy (10.0x,y10.0-10.0\leq x,y\leq 10.0), where (x,y)(x,y) is a vertex of the cake. The vertices will be listed in clockwise order. No three vertices will be collinear. All real numbers have at most 66 digits after the decimal point.

Output

Output a single real number, which is the expected area of the piece of cake that Alice cuts out.

Your answer will be accepted if it is within an absolute error of 10610^{-6}.

4 3
0 0
1 1
2 1
1 0
0.50000000
5 5
0 4
4 2
4 1
3 -1
-2 4
12.50000000
5 3
-1.20 2.80
3.30 2.40
3.10 -0.80
2.00 -4.60
-4.40 -0.50
12.43300000