#P4193. 数字
数字
Description
Xiao D's favorite numbers have the following property.
Let be a positive integer, let be the sum of the digits of , and define as follows.
$$D(n) = \begin{cases} \displaystyle S(n) & S(n) < 10 \\ \displaystyle D(S(n)) & S(n) > 10 \end{cases}$$Every number that Xiao D likes can be written in the form (that is, if a number is liked, then there exists a number such that ).
Xiao D wants to know how many numbers he likes in the interval .
Input Format
The first line contains an integer , the number of test cases.
The next lines each contain two numbers and (the interval is guaranteed to be valid), representing the query .
Output Format
Output lines, each with a single number, indicating how many numbers Xiao D likes appear in this interval.
You will receive full score for a test point if and only if your output exactly matches the standard output.
3
1 5
3 9
8 8
2
2
0
Hint
For of the testdata, and .
Translated by ChatGPT 5
>
京公网安备 11011102002149号