问题4201--Spaceballs

4201: Spaceballs

[命题人 : ]
时间限制 : 3.000 sec  内存限制 : 128 MB

题目描述

Juliet reads an interesting sci-fi book. In one chapter, the main character needs to solve a problem of maximizing the utilization of cargo spaceships. The ships transport valuable items that have the form of D-dimensional mesh with the size of 3 nodes in each dimension. The nodes are formed by balls of the same weight. The connections between balls are so light that their weight is negligible compared to the weight of balls. This means that the weight of any item is determined solely by the number of its nodes. On the other hand, the value of such an item is equal to the number of nodes plus the number of connections.

Each spaceships has a limited tonnage and we want to maximize the total value of items that may be stored in the ship without exceeding the tonnage. Your task is to decide what items of what dimension should be loaded to maximize their total value, providing that we have an unlimited supply of items of all dimensions.

输入

The first line of the input contains the number of test cases N. Each test case then consists of a single line containing one positive integer number K < 10000000 giving the ship cargo capacity.

输出

For each test case, print one line containing space-separated non-negative numbers X m X m−1
... X 1 X 0 , where X m > 0 and X i (0 ≤ i ≤ m) is the number of items of the i-th dimension that
we need to store to maximize their total value.

样例输入 Copy

4
1
100
175
9841

样例输出 Copy

1
1 0 2 0 1
2 0 1 1 1
1 1 1 1 1 1 1 1 1

来源/分类