QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100

#3001. Piece of Cake

统计

Problem Description

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

Alice will now choose exactly $k$ random vertices ($k \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 $n$ and $k$ ($3 \leq k \leq n \leq 2,500$), where $n$ is the number of vertices of the cake, and $k$ is the number of vertices of the piece that Alice cuts.

Each of the next $n$ lines will contain two space-separated real numbers $x$ and $y$ ($−10.0 \leq x, y \leq 10.0$), where $(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 $6$ 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 $10^{−6}$.

Samples

Sample Input 1

4 3
0 0
1 1
2 1
1 0

Sample Output 1

0.50000000

Sample Input 2

5 5
0 4
4 2
4 1
3 -1
-2 4

Sample Output 2

12.50000000

Sample Input 3

5 3
-1.20 2.80
3.30 2.40
3.10 -0.80
2.00 -4.60
-4.40 -0.50

Sample Output 3

12.43300000
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.