#P4250. [SCOI2015] 小凸想跑步

    ID: 3179 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>计算几何2015四川各省省选半平面交

[SCOI2015] 小凸想跑步

Description

Xiao Tu (pinyin: Xiao Tu) likes running on the track at night. After finishing two laps today, he started the following game.

The track is a convex nn-gon whose nn vertices are numbered in counterclockwise order from 00 to n1n - 1. Now Xiao Tu stands uniformly at random at some point inside the track, denoted as point pp. Connect point pp to all nn vertices to form nn triangles (i.e., triangles (p,i,i+1)(p, i, i + 1) for all ii, with indices modulo nn). If the triangle formed by pp, vertex 00, and vertex 11 has the smallest area among these nn triangles, Xiao Tu considers this a correct placement.

Now Xiao Tu wants to know the probability that a single placement is correct.

Input Format

The first line contains an integer nn, the number of vertices of the track.

The next nn lines each contain two integers xi,yix_i, y_i, the coordinates of the vertices.

The input guarantees that the vertices are given in counterclockwise order, they form a convex polygon, and no three points are collinear.

Output Format

Output a single number: the probability of a correct placement, rounded to 44 decimal places.

5
1 8
0 7
0 0
8 0
8 8

0.6316

Hint

For 30%30\% of the testdata, 3n43 \le n \le 4, 0x,y100 \le x, y \le 10.

For 100%100\% of the testdata, 3n1053 \le n \le 10^5, 109x,y109-10^9 \le x, y \le 10^9.

Translated by ChatGPT 5