这道能作出来吗?求助!
X and Y are nonnegative integers.X < Y
if and only if
X's digit sum < Y's digit sum || ( X's digit sum == Y's digit sum && X's value < Y's value )
Given all numbers between A and B, inclusive.
Can you tell me which is the K-th minimum (0-based)?
Input
The first line of the input data will be a integer to represent the number of test cases.
For each test case there is only one line contains three integers A, B and K.
( 0 <= A <= B <= 10^9 , 0 <= K <= B-A)
There is a blank line before each test case.
Output
For each test case output the answer on a single line:
The K-th minimum.
Sample Input
3
0 10 3
50 100 20
12345 123456789 1234567
Sample Output
2
91
22150016
Hint
The order of numbers between 0 and 10, inclusive is
0,1,10,2,3,4,5,6,7,8,9
做k次pop操作 超时的啊!!!
////汗
////汗[[it] 本帖最后由 jiangzw625 于 2008-6-11 20:36 编辑 [/it]] 我自己解决了!
页:
[1]
