시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 29 | 10 | 7 | 70.000% |
Let us call the integer number a bit palindromic, if its first digit is the same as its last digit. We use decimal notation without leading zeroes. Your task is to count how many a bit palindromic numbers are there between l and r, inclusive.
The following numbers are a bit palindromic in the first sample test: 8, 9, 11, and 22.
The numbers in the second sample test — 1251 and 1261.
Input data contains multiple test cases. The first line contains one integer t — the number of test cases (1 ≤ t ≤ 5·104).
Each test case is described by a single line that contains two integers: l and r (1 ≤ l ≤ r ≤ 1018).
For each test case output one integer: how many a bit palindromic numbers are there in the given range.
3 8 25 1251 1266 12 21
4 2 0