100 atcoder#ABC216C. [ABC216C] Many Balls
[ABC216C] Many Balls
Score : points
Problem Statement
We have an empty box. Takahashi can cast the following two spells any number of times in any order.
- Spell : puts one new ball into the box.
- Spell : doubles the number of balls in the box.
Tell us a way to have exactly balls in the box with at most \mathbf{120} casts of spells. It can be proved that there always exists such a way under the Constraints given.
There is no way other than spells to alter the number of balls in the box.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print a string consisting of A
and B
.
The -th character of should represent the spell for the -th cast.
must have at most \mathbf{120} characters.
5
AABA
This changes the number of balls as follows: $0 \xrightarrow{A} 1\xrightarrow{A} 2 \xrightarrow{B}4\xrightarrow{A} 5$.
There are also other acceptable outputs, such as AAAAA
.
14
BBABBAAAB
This changes the number of balls as follows: $0 \xrightarrow{B} 0 \xrightarrow{B} 0 \xrightarrow{A}1 \xrightarrow{B} 2 \xrightarrow{B} 4 \xrightarrow{A}5 \xrightarrow{A}6 \xrightarrow{A} 7 \xrightarrow{B}14$. It is not required to minimize the length of .