Even-dominant Numbers
Time limit3sMemory limit2048 MB
For each query, count the integers x in [l, r] whose even digit count, together with the digits of floor(sqrt(x)), exceeds the odd digit count.
- Level
Hard8 of 10
- Topics
- Dynamic programming, Math
- Solved
- No attempts yet
Problem
This is an interactive problem.
Let be an even-dominant number if the total number of even decimal digits of and (the decimal representation of the square root of , rounded down to the nearest integer) is greater than the total number of odd decimal digits of these numbers.
For example, is an even-dominant number because the total number of even digits in and is , which is greater than , the total number of odd digits. However, the number is not an even-dominant number because the total number of even digits in and is equal to the total number of odd digits.
Determine the number of even-dominant numbers in the segment .
Input
The first line contains one integer (): the number of queries.
Each of the next lines contains two integers and () denoting the segment for the -th query.
Output
For each query, print a line with a single integer: the number of even-dominant numbers in the given segment.