A number is called a Mirror number if on lateral inversion, it gives the same number i.e it looks the same in a mirror. For example 101 is a mirror number while 100 is not.
Given two numbers a and b, find the number of mirror numbers in between them (inclusive of a and b).
Input
First line contains T, number of testcases <= 10^5.
Each testcase is described in a single line containing two numbers a and b.
0 <= a<=b <= 10^44
Output
For each test case print the number of mirror numbers between a and b in a single line.
Example
Input: 3 0 10 10 20 1 4 Output: 3 1 1
题目大概:
找出所给数字间的所有镜像数的数量,不能是252这样的回文数,必须是10801这样的数字。
思路:
和回文数的思路差不多,不过这个题数据量大一点需要字符串来村数据。
而且,这个要判断一下给出的最小的数字是不是镜像数,最后多减了,要加回来。
代码: