Codeforces Round 139 (Div. 2)
B
Well-known Numbers
Codeforces
1600
原题
← AC →
翻译中…

Numbers $*k*$-bonacci ($*k*$ is integer, $*k* > 1$) are a generalization of Fibonacci numbers and are determined as follows:

翻译中…
  • $*F*(*k*, *n*) = 0$, for integer $*n*$, $1 ≤ *n* < *k*$;
  • $*F*(*k*, *k*) = 1$;
  • $*F*(*k*, *n*) = *F*(*k*, *n* - 1) + *F*(*k*, *n* - 2) + ... + *F*(*k*, *n* - *k*)$, for integer $*n*$, $*n* > *k*$.
翻译中…

Note that we determine the $*k*$-bonacci numbers, $*F*(*k*, *n*)$, only for integer values of $*n*$ and $*k*$.

翻译中…

You've got a number $*s*$, represent it as a sum of several (at least two) distinct $*k*$-bonacci numbers.

翻译中…

Input

翻译中…

The first line contains two integers $*s*$ and $*k*$ $(1 ≤ *s*, *k* ≤ 10^{9}; *k* > 1)$.

翻译中…

Output

翻译中…

In the first line print an integer $*m*$ $(*m* ≥ 2)$ that shows how many numbers are in the found representation. In the second line print $*m*$ distinct integers $*a*_{1}, *a*_{2}, ..., *a*_{*m*}$. Each printed integer should be a $*k*$-bonacci number. The sum of printed integers must equal $*s*$.

翻译中…

It is guaranteed that the answer exists. If there are several possible answers, print any of them.

翻译中…

样例

Input #1
5 2
Output #1
3
0 2 3
InputCopy OutputCopy
Input #2
21 5
Output #2
3
4 1 16
InputCopy OutputCopy
题目信息
题号
225B
时间限制
2 s
内存限制
256 MB
标签
二分
贪心
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。