ARRANGE2 - Rearranging Digits

no tags 

Given A and B, how many numbers between A and B (with no leading 0's) rearrange their digits when multiplied by 2 ?

Input :
The first line contains the number of test cases T. T lines follow, containing two integers A and B.

Output :
Output T lines, one for each test case containing the desired answer for the corresponding test case.

Sample Input :
2
1 100
499875921 499875921

Sample Output :
0
1

Constraints :
1 <= T <= 10000
1 <= A <= B <= 10000000000 (10^10)


hide comments
vivek yadav: 2011-01-28 17:39:56

@ varun:
explain atleast one example.
what u want to say in prob....


Added by:Varun Jalan
Date:2010-07-26
Time limit:0.189s
Source limit:5000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC PERL6 VB.NET
Resource:own problem