编程介的小学生 2019-05-21 13:46 采纳率: 20.5%
浏览 173

求数字的每个数位的和的问题,怎么利用C语言程序代码的程序编写步骤方式的实现

Problem Description
Let S(N) be digit-sum of N, i.e S(109)=10,S(6)=6.

If two positive integers a,b are given, find the least positive integer n satisfying the condition a×S(n)=b×S(2n).

If there is no such number then output 0.

Input
The first line contains the number of test caces T(T≤10).
The next T lines contain two positive integers a,b(0<a,b<101).

Output
Output the answer in a new line for each test case.

Sample Input
3
2 1
4 1
3 4

Sample Output
1
0
55899

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 js调用html页面需要隐藏某个按钮
    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥15 一道python难题3
    • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试