QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 256 MB مجموع النقاط: 100

#18662. 会计记数系统

الإحصائيات

最新的“账务进制系统”(Accounting Numeral System)是世界上最顶尖的记账系统。其发明者 Ceizenpok 博士是该领域的顶尖专家。在该系统中,任何基于基数 $m$ 的正整数 $n$ 都可以表示为 $m$ 项的和:

$$n = C_{x_m}^m + C_{x_{m-1}}^{m-1} + C_{x_{m-2}}^{m-2} + \dots + C_{x_1}^1$$

其中 $x_1, x_2, \dots, x_m$ 是满足 $0 \le x_1 < x_2 < \dots < x_m$ 的整数。我们的专家将数值 $C_k^m = \frac{k!}{m!(k-m)!}$ 称为“账务指数”(accounting indexes)。在该系统中,每个数 $n$ 被记录为 $n = (x_m)\dots(x_2)(x_1)$,并且规定 $0! = 1$,且当 $m > k$ 时 $C_k^m = 0$。例如,在基数为 3 的账务系统中,数字 9 被记录为 $(4)(3)(2)$,因为 $9 = C_4^3 + C_3^2 + C_2^1$;而在基数为 2 的账务系统中,数字 1 被记录为 $(2)(0)$,因为 $1 = C_2^2 + C_0^1$。

你需要求出正整数 $n$ 在基数为 $m$ 的账务进制系统中的表示。

输入格式

单行包含两个整数 $n$ 和 $m$($1 \le n \le 10^{16}$,$2 \le m \le 1000$)。

输出格式

单行输出一个由空格分隔的 $m$ 个整数组成的序列 $x_m, \dots, x_2, x_1$,表示数字 $n$ 在账务进制系统中的表示。其中 $x_m$ 是该表示中最左侧的数字,$x_1$ 是最右侧的数字。

样例

输入样例 1

9 3

输出样例 1

4 3 2

输入样例 2

5 2

输出样例 2

3 2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.