QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#18333. 运行数

統計

如果一个正整数 $x$ 的所有数位上的数字都相同,我们称其为“同数”(run number)。例如,$4$、$111$、$888\,888$ 是同数,而 $27$、$334$、$100\,000$ 不是。

给定一个 $n$ 位数 $k$,将 $k$ 表示为最多 $(n + 1)$ 个同数的和。可以证明,解总是存在的。

输入格式

第一行包含一个整数 $t$,表示测试用例的数量($1 \le t \le 100$)。

每个测试用例包含一行,其中有两个整数:$n$ 和 $k$($1 \le n \le 17$,$10^{n - 1} \le k < 10^n$)。

输出格式

对于每个测试用例:

  • 第一行输出一个整数 $m$:相加等于 $k$ 的同数个数($1 \le m \le n + 1$)。
  • 第二行输出这 $m$ 个同数,顺序任意。
  • 如果存在多个解,输出其中任意一个。

样例

输入样例 1

2
4 2024
3 506

输出样例 1

4
999 999 22 4
3
444 55 7

输入样例 2

2
17 99999999999999999
9 333666999

输出样例 2

1
99999999999999999
3
333333333 333333 333

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.