P17525 [CodeChef] PALSUM
提高-
题目描述

We call a non-negative number x good if its binary representation is palindromic. For example, 107 is good because its binary representation is 1101011 which is palindromic while 10 is not good because its binary representation is 1010 which is not palindromic.

Recall that, a string is said to be palindromic if it reads the same backward as forward.

You are given a number n. You have to express n as a sum of at most 12 good numbers. If there exist multiple answers, print any one of them.

------ Input Format ------

  • The first line of the input contains a single integer T denoting the number of test cases. The description of T test cases follows.
  • The first and only line of each testcase contains a single integer n.

------ Output Format ------

For each testcase, print a single integer m (1 ≤ m ≤ 12), denoting the number of good numbers. In the next line, print a sequence of m good numbers whose sum is equal to n. If there are multiple such sequences, print any of them.

------ Constraints ------

$1 ≤ T ≤ 1000$
$1 ≤ n ≤ 1000$

----- Sample Input 1 ------
2
24
4

----- Sample Output 1 ------
2
21 3
4
1 1 1 1

----- explanation 1 ------
Test case $1$:
- $21$ is good because $21 = (10101)_2$ which is palindromic.
- $3$ is good because $3 = (11)_2$ which is palindromic.

Test case $2$:
- $1$ is good because $1 = (1)_2$ which is palindromic.

Here $()_2$ denotes binary representation of the number.

输入格式

见题面

输出格式

见题面

样例输入
2 24 4
样例输出
2 21 3 4 1 1 1 1