|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초 (추가 시간 없음)||512 MB||2||1||1||50.000%|
Recently, Alice and her sister Clara learned about adorable numbers: A positive integer $n$ is called adorable if there exist some integers $a, b,$ and $c$ so that an equilateral triangle with side length $c$ can be tiled with $n$ smaller equilateral triangles, each having a side length of either $a$ or $b$. For instance, $6$ is an adorable number as shown in Figure I.1a below.
|(a) Visualization of the second sample output.||(b) Coordinate system used for the output.|
They decided to see who can come up with more adorable numbers, but it turns out that checking all the numbers manually is too cumbersome. Therefore, Alice asked you to help her check whether the numbers Clara listed are adorable or not. As she wants to be sure that every number claimed to be adorable really is adorable, she asked you to write a program that, given an integer $n$, determines if it is adorable and if so, outputs a valid tiling as shown in Figure I.1a.
The input consists of:
If the given integer $n$ is adorable, output a valid tiling using the following format:
B, specifying if the side length of the triangle is $a$ or $b$;
D, specifying whether the triangle is pointing upwards or downwards.
Otherwise, if $n$ is not adorable, output
If your tiling consists of triangles that all have the same size, you may either use
B exclusively for all of your triangles, or set $a = b$ and arbitrarily label each triangle with
It can be shown that for every adorable number in the input range it is possible to construct a tiling according to the above set of rules. You may output any valid tiling.
1 2 3 B 0 1 U A 0 0 U A 0 1 D A 1 0 U A 1 1 D A 2 0 U