2016女生赛 HDU 5710 Digit-Sum(数学,思维题)
Digit-Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 782 Accepted Submission(s): 241 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 ( 2 n ) . 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