Expected Area

All submissions for this problem are available.
You are given a convex polygon $P$ with vertices $P_0, P_1, \ldots, P_{n1}$, each having integer coordinates. On each edge $P_{i} P_{(i+1) \% n}$ of the polygon, choose a point $R_i$ uniformly at random. What is the expected area of the convex hull of these $n$ chosen points $R_0, R_1, \ldots R_{n1}$ ? ###Note  Consider the area of the convex hull as zero if it contains less than 3 vertices.  All the points $R_i$ are chosen independently of each other.  Your answer is considered correct if and only if its absolute or relative error doesn't exceed $10^{6}$. ### Input  The first line contains $n$, the number of vertices in the convex polygon.  The next $n$ lines contain the coordinates of the vertices of the polygon in anticlockwise order. ### Output For each testcase, print the expected area of the convex hull of the $n$ randomly chosen points. ### Constraints  $3 \leq n \leq 10^5$  The absolute values of all the coordinates $\leq 10^7$.  All the points in the input are distinct.  The described polygon $P$ is convex and the vertices of the polygon are given in anticlockwise order. Also, no three vertices of the polygon are collinear. ### Example Input ``` 3 0 0 1 0 0 1 ``` ### Example Output ``` 0.1250000000 ```Author:  jtnydv25 
Editorial  https://discuss.codechef.com/problems/EAREA 
Tags  easy, expectedvalue, geometry, jtnydv25 
Date Added:  12122019 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 