P28251 [洛谷] [CQOI2010] Mole
提高+
题目描述

Problem Description

Hilbert the Mole lives in a Hilbert cave—the boundary of the cave is an $n$-th order Hilbert curve $H_n$. The definition of the Hilbert curve is as follows: $H_1$ is a unit square with an upper gap; $H_n$ is composed of four copies of $H_{n-1}$, where the bottom-left and bottom-right parts remain unchanged, the top-left part is rotated 90 degrees counterclockwise, and the top-right part is rotated 90 degrees clockwise. These four parts are connected by three unit-length segments to form $H_n$. The curves from $H_1$ to $H_4$ are shown in the following image:

You want to catch a Hilbert mole to play with, so you pour water into the cave to drive them out. However, due to the presence of air in the cave, no matter how much water you pour, some areas will always remain dry (assuming both water and air are incompressible). Given the order of the Hilbert curve $n$ and the inclination angle of the ground $α$, your task is to calculate the submerged area.

Note that water can only flow over an obstacle if the water level is strictly higher than the obstacle. More details can be found in the examples below.

Input Format

The input consists of two integers $n$ and $α$.

Output Format

Output a single line, the submerged area, rounded to six decimal places.

Sample Input and Output

Sample Input #1

5 30

Sample Output #1

190.803848

Sample Input #2

3 45

Sample Output #2

15.500000

Sample Input #3

4 10

Sample Output #3

91.573592

Sample Input #4

3 0

Sample Output #4

26.000000

Notes

$n \leq 12, 0 \leq α \leq 90$

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 30
样例输出
190.803848