404239: GYM101466 D Double it
Memory Limit:64 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
D. Double ittime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output
Alex has two magic machines A and B. Machine A will give you 2x + 1 coins if you insert x coins in it, machine B will give you 2x + 2. Alex has no coins and wants to get exactly n coins in order to buy a new unicorn, but he can't figure out how to do it. Your task is to find a way to use the machines to get exactly n coins.
InputThe input consists of a single line containing n (1 ≤ n ≤ 109).
OutputFor each one output a string of A's and B's giving the order in which the machines are used.
ExamplesInput7Output
AAAInput
10Output
ABB