#P4250. Correct Standing Probability on a Convex Polygon Playground

    ID: 17497 Type: Default 1000ms 256MiB

Correct Standing Probability on a Convex Polygon Playground

Correct Standing Probability on a Convex Polygon Playground

A convex polygon with n sides is given. The n vertices are labeled in counterclockwise order from 0 to n-1. A point p is chosen uniformly at random from inside the polygon. Connecting p with every vertex divides the polygon into n triangles. If the area of the triangle formed by p, vertex 0, and vertex 1 is the smallest among these n triangles, then the standing position is considered correct.

Your task is to determine the probability that a random point p yields a correct standing position. It can be shown that the answer is given by the formula $$\frac{1}{n}$$ where n is the number of sides of the polygon.

inputFormat

The input consists of a single integer n (n ≥ 3) representing the number of sides of the convex polygon.

outputFormat

Output a decimal number representing the probability that the triangle formed by the point p, vertex 0, and vertex 1 is the smallest among all the triangles. The result should be accurate up to at least 6 decimal places.

sample

3
0.333333