#Lutece0822. F(x)
F(x)
Migrated from Lutece 822 F(x)
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
For a decimal number with digits (), we define its weight as $F(x)=A_{n}\times 2^{n-1}+A_{n-1}\times 2^{n-2}+\cdots +A_{2}\times 2+A_{1}\times 1$. Now you are given two numbers and , please calculate how many numbers are there between and , inclusive, whose weight is no more than .
Input
The first line has a number () , indicating the number of test cases.
For each test case, there are two numbers and ()
Output
For every case,you should output Case #t:
at first, without quotes.
The is the case number starting from .
Then output the answer.
Samples
3
0 100
1 10
5 100
Case #1: 1
Case #2: 2
Case #3: 13
Resources
2013 ACM/ICPC Asia Regional Chengdu Online