#P4179. [CQOI2010] 鼹鼠

[CQOI2010] 鼹鼠

Description

The Hilbert mole lives in a Hilbert burrow — the burrow’s boundary is an order-nn Hilbert curve HnH_n. The Hilbert curve is defined as follows: H1H_1 is a unit square with an opening at the top; HnH_n is composed of four copies of Hn1H_{n-1}, where the lower-left and lower-right copies remain unchanged, the upper-left copy is rotated 90 degrees counterclockwise, and the upper-right copy is rotated 90 degrees clockwise. These four copies of Hn1H_{n-1} are connected by three unit-length segments to form HnH_n. H1H_1H4H_4 are shown below.

You want to catch a Hilbert mole, so you pour water into the burrow to flush it out. However, because there is air inside the burrow and both water and air are incompressible, some places can never be flooded no matter how much water you pour. Given the order nn of the Hilbert curve

and the ground tilt angle α\alpha, your task is to compute the area that can be flooded.

Note that water can flow past an obstacle only when the water level is strictly higher than the obstacle. See the example below for more details.

Input Format

The input contains two integers nn and α\alpha.

Output Format

Output a single line with the flooded area, with 6 digits after the decimal point.

5 30
190.803848
3 45
15.500000
4 10
91.573592

3 0
26.000000


Hint

Constraints: n12n \le 12, 0α900 \le \alpha \le 90.

Translated by ChatGPT 5