#P9718. [EC Final 2022] Best Carry Player 2
[EC Final 2022] Best Carry Player 2
题目描述
Given a positive integer , find the minimum positive integer such that the number of of is exactly .
We adds numbers , just like what we normally do in primary school. For example, there are two carries in the following addition.
which means 进位
in Chinese.
输入格式
The first line contains an integer the number of test cases.
For each test case, the first line contains two integers .
输出格式
For each test case, output one integer representing the answer in one line. If there is no solution, output instead.
4
12345678 0
12345678 5
12345678 18
990099 5
1
54322
999999999987654322
9910