#B. 优秀的拆分 (Excellent Split)

    传统题 1000ms 256MiB

优秀的拆分 (Excellent Split)

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

Generally speaking, a positive integer can be split into the sum of several positive integers.

Example: 1=1,10=1+2+3+41 = 1, 10 = 1 + 2 + 3 + 4.

For a positive integer nn we call it excellent if and only if under this kind of separation, nn is broken down into several different numbers such that each number is a positive power of 22. Note that a number xx can be expressed as a positive power of 22, if and only if x=2kx = 2^k for some integer k1k \ge 1.

Example: 10=8+2=23+2110 = 8 + 2 = 2^3 + 2^1 is an excellent split. But, 7=4+2+1=22+21+207 = 4 + 2 + 1 = 2^2 + 2^1 + 2^0 is not an excellent split, because 11 is not 22 to the power of a positive integer.

Now, given a positive integer nn, you need to judge whether there is an excellent split among all the splits of this number. If so, please give a specific split plan.

Input Format

The input is only one line, an integer nn, that represents the number to be split.

Output Format

If there is an excellent split among all the splits of this number, then you need to output each number in this split from largest to smallest, separated by a space between two adjacent numbers. It can be proved that after the order of splitting numbers is specified, the splitting plan is unique.

If there is no excellent split, output -1.

6
4 2
7
-1

Constraints

For 20%20\% of the data, n10n \le 10.
For another 20%20\% of the data, nn is guaranteed to be odd.
For another 20%20\% of the data, nn is guaranteed to be a positive power of 22.
For 80%80\% of the data, n1024n \le 1024.
For 100%100\% of the data, 1n1071 \le n \le 10^7.

2023级晚训第4周练习,截止时间为10天

未参加
状态
已结束
规则
IOI
题目
12
开始于
2023-11-6 21:45
结束于
2023-12-6 21:45
持续时间
720 小时
主持人
参赛人数
132