Codeforces Round 742 (Div. 2)
D
Expression Evaluation Error
Codeforces
2000
原题
← CE →
翻译中…

On the board, Bob wrote $n$ positive integers in base $10$ with sum $s$ (i. e. in decimal numeral system). Alice sees the board, but accidentally interprets the numbers on the board as base-$11$ integers and adds them up (in base $11$).

翻译中…

What numbers should Bob write on the board, so Alice's sum is as large as possible?

翻译中…

Input

翻译中…

The input consists of multiple test cases. The first line contains an integer $t$ ($1 \leq t \leq 100$) — the number of test cases. The description of the test cases follows.

翻译中…

The only line of each test case contains two integers $s$ and $n$ ($1 \leq s \leq 10^9$; $1 \leq n \leq \min(100, s)$) — the sum and amount of numbers on the board, respectively. Numbers $s$ and $n$ are given in decimal notation (base $10$).

翻译中…

Output

翻译中…

For each test case, output $n$ positive integers — the numbers Bob should write on the board, so Alice's sum is as large as possible. If there are multiple answers, print any of them.

翻译中…

Note

翻译中…

In the first test case, $70_{10} + 27_{10} = 97_{10}$, and Alice's sum is $$70_{11} + 27_{11} = 97_{11} = 9 \cdot 11 + 7 = 106_{10}.$$ (Here $x_b$ represents the number $x$ in base $b$.) It can be shown that it is impossible for Alice to get a larger sum than $106_{10}$.

翻译中…

In the second test case, Bob can only write a single number on the board, so he must write $17$.

翻译中…

In the third test case, $3_{10} + 4_{10} + 100_{10} + 4_{10} = 111_{10}$, and Alice's sum is $$3_{11} + 4_{11} + 100_{11} + 4_{11} = 110_{11} = 1 \cdot 11^2 + 1 \cdot 11 = 132_{10}.$$ It can be shown that it is impossible for Alice to get a larger sum than $132_{10}$.

翻译中…

样例

Input #1
6
97 2
17 1
111 4
100 2
10 9
999999 3
Output #1
70 27
17
3 4 100 4
10 90
1 1 2 1 1 1 1 1 1
999900 90 9
InputCopy OutputCopy
题目信息
题号
1567D
时间限制
2 s
内存限制
256 MB
标签
构造
贪心
模拟
数学

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