Pumpkinomics
Frank has opened a new pumpkin farm and he aims to make it big in the farming industry. To get started, he ran an investment round, over-promising returns and safety. However, he didn't get any money from this, as the investors were not confident. Instead, he was only given a single giant pumpkin of size .
Luckily, Frank has a magical pumpkin cloning device he found in the basement of the UNSW engineering building. By feeding it a pumpkin of size , he can produce two healthy pumpkins with sizes
and
(both rounding down i.e. floor division). Frank can repeat this process as many times as he likes, but a pumpkin of size
cannot be cut, or else a black hole would be created.
Frank aims to enter the local pumpkin-growing contest. Winning would be a boon to his business, as all the local farmers would know his name and he would gain massive aura. The contest asks for of the biggest distinctly-sized pumpkins, which Frank can create through repeatedly cloning different pumpkins, starting with the single pumpkin he received as an investment. What are the
biggest pumpkins that can be produced, in descending order of size, so Frank has the best possible chance at winning and making it big?
Input
The input contains two integers and
, where
represents the size of the pumpkin given to Frank as an investment, while
represents the amount of distinctly sized pumpkins to be reported.
Output
Output space-separated integers, where these are the biggest pumpkins that you can generate by repeatedly applying the cloning process to the initial pumpkin. The output should be all distinct sizes, and given in descending order. If it is impossible to make
distinctly-sized pumpkins, output all the possible pumpkins in descending order.
Example
Input 1
10 7
Output 1
10 5 3 2 1 0
These are the only pumpkins that are possible to create using the cloning machine, so we output them in descending order.
Input 2
127 6
Output 2
127 63 42 31 21 15
Comments