P26980 [AtCoder] Circle and Triangle
提高+
题目描述

Problem Description

There is a circle with a radius of $1$, and vertices $1$ to $N$ are arranged clockwise.
The vertices divide the circumference of the circle into $N$ equal parts.
square1001 is trying to create a triangle by selecting three vertices.

Among the $\frac{N(N-1)(N-2)}{6}$ possible ways to create a triangle, output the area of the triangle that is the $K$-th smallest in terms of area.
If there are triangles with the same area, it is sufficient to output the area, and the order does not matter.

For example, when $ N = 4, K = 3 $, it works as follows:
- When the vertex numbers are $ (1,2,3) $, the area $ = 1 $
- When the vertex numbers are $ (1,2,4) $, the area $ = 1 $
- When the vertex numbers are $ (1,3,4) $, the area $ = 1 $
- When the vertex numbers are $ (2,3,4) $, the area $ = 1 $

Therefore, the area of the 3rd triangle $ = 1.0 $.
Problem Author: E869120

Input Format

The input is given from the standard input in the following format:

$N\ K$

  • The first line contains the number of points on the circumference $ N $ and the integer $ K $ representing the $K$-th triangle, separated by a space.

Output Format

  • Output the area of the triangle that is the $K$-th smallest in terms of area.
  • The answer will be considered correct if the absolute or relative error is at most $ 10^{-9} $.

Sample Input and Output

Sample Input #1

4 3

Sample Output #1

1.000000000000000000

Sample Input #2

6 9

Sample Output #2

0.86602540378

Sample Input #3

12 220

Sample Output #3

1.29903810568

Notes/Hints

Constraints

  • $3 \le N \le 200,000$
  • $1 \le K \le \frac{N(N - 1)(N - 2)}{6}$

Subtasks

Subtask 1 \[ $ 160 $ points \]

  • $N \le 100$

Subtask 2 \[ $ 240 $ points \]

  • $N \le 1000$

Subtask 3 \[ $ 450 $ points \]

  • No additional constraints.

Sample Explanation 1

This input example is as explained in the problem statement.

Sample Explanation 2

When $ N = 6 $, there are 6 ways to choose vertices such that the area is $\frac{\sqrt{3}}{4}$, 12 ways to choose vertices such that the area is $\frac{\sqrt{3}}{2}$, and 2 ways to choose vertices such that the area is $\frac{3 \sqrt{3}}{4}$. Therefore, the area of the 9th triangle is $\frac{\sqrt{3}}{2}$.

Sample Explanation 3

When $ N = 12 $, there are $\frac{12 \times 11 \times 10}{6} = 220$ ways to create a triangle. The largest area is when the triangle is equilateral, so the area of the 220th triangle is $\frac{3 \sqrt{3}}{4}$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 3
样例输出
1.000000000000000000