#P2320. [HNOI2006] 鬼谷子的钱袋

    ID: 1289 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>2006各省省选湖南Special Judge进制

[HNOI2006] 鬼谷子的钱袋

Description

Guiguzi is very clever. Because of this, he is very busy, and envoys from various feudal lords often come to consult him on current affairs.

One day, while he was traveling in Xianyang, a friend told him that the largest auction house in Xianyang (Jubao Trading House) was about to hold an auction. One of the treasures caught his great interest: the Wordless Heavenly Book.

However, his schedule was very tight. He had already bought a long-distance carriage ticket to Handan, and unfortunately the departure time was just as the auction would be ending. Therefore, he decided to prepare in advance: count his gold coins and seal them into small money bags, so that within the limit of his current total coins, he could pay any number of coins by selecting a combination of these sealed small bags.

Guiguzi is also very frugal. He tries to minimize the number of money bags while satisfying the above requirement, and no two bags contain the same number of coins greater than 11. Suppose he has mm gold coins. Can you figure out how many money bags he will use, and how many coins each bag will contain?

Input Format

Contains one integer, representing Guiguzi’s total number of gold coins mm. Where 1m1091 \le m \le 10^9.

Output Format

Two lines. The first line contains an integer hh, the number of money bags used.

The second line contains the number of coins in each bag, output in increasing order and separated by spaces.

3

2
1 2

Hint

Translated by ChatGPT 5