#P4179. [CQOI2010] 鼹鼠
[CQOI2010] 鼹鼠
Description
The Hilbert mole lives in a Hilbert burrow — the burrow’s boundary is an order- Hilbert curve . The Hilbert curve is defined as follows: is a unit square with an opening at the top; is composed of four copies of , 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 are connected by three unit-length segments to form . – 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 of the Hilbert curve

and the ground tilt angle , 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 and .
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: , .
Translated by ChatGPT 5
京公网安备 11011102002149号