Ground Works | 프로그래밍의 벗 PivotOJ
PivotOJ

Ground Works

시간 제한: 3000ms메모리 제한: 256MB출처: NEERC Northern Subregional 2008BOJ 3577
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

The Hilbert Mole is a small and very rare mole. The first and only specimen was found by David Hilbert at his backyard. This mole lives in a huge burrow under the ground, and the border of this burrow forms a Hilbert curve of n-th order (Hn).

Hilbert curves can be defined as follows. H1 is a unit square with open top side (fig. 1a), Hn consists of four copies of Hn−1: bottom left and bottom right are copied without changes, top left is rotated 90 counter-clockwise and top right is rotated 90 clockwise. These small copies are connected by three segments of unit length (fig. 1b,c,d).

[이미지 1] [이미지 2] [이미지 3] [이미지 4]
a b c d

Fig. 1. Hilbert curves, order 1 to 4.

Trying to exterminate the mole, Mr. Hilbert fills the burrow with water (fig. 2). But air inside the burrow prevents water from filling it entirely. In this problem we suppose that air and water are incompressible and cannot leak throw the borders of the burrow. Your task is to find the total area of the burrow, filled with water.

[이미지 5]

Fig. 2. Burrow, filled with water.

Note that water can flow over the obstacle only when its level is strictly higher. See examples on fig. 3 for further clarification.

[이미지 6]

Fig. 3. More examples of filled burrows.

입력

The first line of the input file contains two integer numbers: n and α — order of Hilbert curve and slope angle of surface in degrees (1≤n≤12, 0≤α<90).

출력

The first line of the output file must contain a single real number — the total area of the burrow, filled with water. The relative error of the answer must not exceed 10−7.

예제

예제 1

입력
5 30
출력
190.803847577293

예제 2

입력
3 45
출력
15.5

예제 3

입력
4 10
출력
91.573591766702

예제 4

입력
3 0
출력
26.0
코드를 제출하려면 로그인하세요.