编程介的小学生 2019-09-02 10:36 采纳率: 20.5%
浏览 277

Sum of Digits 数码的和的问题

Problem Description
Petka thought of a positive integer n and reported to Chapayev the sum of its digits and the sum of its squared digits. Chapayev scratched his head and said: "Well, Petka, I won't find just your number, but I can find the smallest fitting number." Can you do the same?

Input
The first line contains the number of test cases t (no more than 10000). In each of the following t lines there are numbers s1 and s2 (1 ≤ s1, s2 ≤ 10000) separated by a space. They are the sum of digits and the sum of squared digits of the number n.

Output
For each test case, output in a separate line the smallest fitting number n, or "No solution" if there is no such number or if it contains more than 100 digits.

Sample Input
4
9 81
12 9
6 10
7 9

Sample Output
9
No solution
1122
111112

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Matlab问题解答有两个问题
    • ¥50 Oracle Kubernetes服务器集群主节点无法访问,工作节点可以访问
    • ¥15 LCD12864中文显示
    • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
    • ¥15 gsoap生成onvif框架
    • ¥15 有关sql server business intellige安装,包括SSDT、SSMS。
    • ¥15 stm32的can接口不能收发数据
    • ¥15 目标检测算法移植到arm开发板
    • ¥15 利用JD51设计温度报警系统
    • ¥15 快手联盟怎么快速的跑出建立模型