eolymp
bolt
Try our new interface for solving problems
Problems

Sum of Powers

Sum of Powers

Consider the set of integers \textbf{\{0, 1, 2, ..., 2^n-1\}}. Your task is to divide it into two sets, \textbf{A} and \textbf{B}, so that the sums of \textbf{k}^\{th \}powers of elements in these sets are equal, or report that such a division is impossible. In this problem, we assume that \textbf{0^0 = 1}. \InputFile The only line of input contains two integers \textbf{n} and \textbf{k} (\textbf{0} ≤ \textbf{k} < \textbf{n} ≤ \textbf{16}). \OutputFile If a solution exists, print \textbf{2^n} letters without spaces on a single line: for each integer from \textbf{0} to \textbf{2^n-1}, print the name of the set in which you put it (letter \textbf{A} or \textbf{B}). If there is more than one possible solution, print any one of them. If the division is impossible, print \textbf{NO SOLUTION} on a single line instead.
Time limit 1 second
Memory limit 256 MiB
Input example #1
2 1
Output example #1
ABBA
Source 2013 Petrozavodsk, MIPT contest, August 25, Problem I