Memory limit: 256 MiB
Time limit: 1000 ms
Input file: stdin
Output file: stdout
Problem type: traditional
Judging mode: text compare
Bob likes Triple Numbers, Alice likes Fancy Numbers, guess what Charlie likes? Charlie likes Sandwich Numbers (since he likes eating a lot). Bob and Alice wants to give Charlie a surprise, so they decided to make a Sandwich Number for him.
A Sandwich Number is described as follows:
- It contains odd number of digit
- Denote units digit as 0th digit, tens digit as 1st digit, etc. The even digits (0th, 2nd...) should be 1, and the odd digits (1st, 3rd...) should not be 1.
For instance, $12131$, $151$, $121314151$, $1$ are sandwich numbers, but $111$, $112$, $1010$ are not.
Bob and Alice wonders how many Sandwich Numbers are there between two positive integers $L$ and $R$ (inclusively). Please help them to find it out.
Each test contains multiple test cases. The first line contains the number of test casesĀ $t$. The description of the test cases follows.
The first line and the only line of each test case contains two positive integers $L$ and $R$.
For each test case, output the number of Sandwich Numbers lying between $L$ and $R$ (inclusively) in a single line.
For all test data,
$1 \le t \le 100$
$1 \le L \le R \le 10$$9$
Subtask |
Score |
Additional Constraints |
$1$ |
$30$ |
$1 \le L \le R \le 10^5$ |
$2$ |
$70$ |
No additional constraints |