Logo
(追記) (追記ここまで)

10312번 - Lodê 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB24719917779.730%

문제

In 1999, there were another three contests at the Czech Technical University: faculty round (FEL++), CTU Open, and Central Europe Regional Contest. The enthusiasm of the “founding fathers” had decreased a little bit and there was no wonder. They had been organizing two or three competitions a year for a period of five years. What had once been fun turned into hard work. Fortunately, many new organizers arose from the former contestants, so the tradition could go on.

The problem Lodē was added to the 1999 contest at the very last moment and it was intended to be an easy one. Now you may find out yourselves how difficult or easy it was.


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.

zero dimension first dimension second dimension
weight = 1 weight = 3 weight = 9
price = 1 price = 5 price = 21

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 < 10 000 000 giving the ship cargo capacity.

출력

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

제한

예제 입력 1

4
1
100
175
9841

예제 출력 1

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

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > CTU Open Contest > CTU Open Contest 2014 D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /