2 shunfurh shunfurh 于 2017.09.17 21:48 提问

Need for Pipes

Suppose that you need to buy some pipes because you have to build a long pipe using the pipes. Wired enough, you find that in the shop, all of the pipes with different lengths have the same price. You have limited money and limited material with which you can connect the pipes. Your task is to buy the appropriate pipes with which you can build a longer pipe with all kinds of lengths from 1 to N so that N is maximal.

1. the lengths are integers;
2. every pipe is worthy of 100 yuans, and the money you have is between 0-700;
3. the material needed to connect the pipe is limited. The number of pipes you can connect is between 0 and 5;
4. once a kind of pipe with a certain length is bought, you can get as many pipes of that length as you wish.

For example: if we have 590 yuan and the material can mostly connect 4 pipes ,then we can buy 5 pipes. If we buy the pipes of lengths 1, 3, 11, 15, and 32, we will be able to make pipes with lengths 1, 2, 3, 4, ..., 70 where 70 is the maxmum length we can get.


In the first line of input there is a single N (< 50) denoting the number of cases. Each case occupies one line which contains two numbers m and n expressing the maximum number of pipes we can connect and the money we have.


For each test case, output the maxmial length we can get in the first line and the lengths of pipes you should buy in the second line.
If there are several possibilities, output the smaller sequence. For example, sequence (1,3,4) is considered smaller than sequence (1,4,5) so you should output 1 3 4. If the task is impossible, just output "sorry".

Sample Input


4 500

2 0

Sample Output

1 3 11 15 32


caozhy   Ds   Rxr 2017.10.02 08:51
Csdn user default icon