Any number is called beautiful if it consists of $$2N$$ digits and the sum of the first $$N$$ digits is equal to the sum of the last $$N$$ digits. Your task is to find the count of beautiful numbers in the interval from $$L$$ to $$R$$ (including $$L$$ and $$R$$).
Beautiful numbers do not have leading zeroes.
Input format
- The first line contains an integer $$T$$ denoting the number of test cases.
- The first line of each test case contains two space-separated integers $$L$$ and $$R$$ denoting the range interval \([L,R]\).
Output format
For each test case, print the count of beautiful numbers in a new line.
Constraints
There are only $$9$$ beautiful numbers in the first $$100$$ integers. \(11,22,33,44,55,66,77,88\) and $$99$$ are the beautiful numbers in the range \([1,100]\).
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor