The 7th(2012) ACM Programming Contest of HUST - Preliminary Contest

From: 2012-11-17 12:00:00 To: 2012-11-17 17:00:00 Now: 2017-09-22 07:03:53 Status: Public

B - Lucky Numbers

Time Limit: 2s Memory Limit: 64MB

Submissions: 436 Solved: 124
Isun loves digit 4 and 8 very much. He thinks a number is lucky only if the number satisfy the following conditions:
1.       The number only consists of digit 4 and 8.
2.       The number multiples 48.
One day, the math teacher gives Isun a problem:
         Given L and R(1 <= L <= R <= 10^15), how many lucky numbers are there between L and R. (i.e. how many x satisfy L <= x <= R, x is a lucky number).
Multiple test cases. For each test case, there is only one line consist two numbers L and R.
For each test case, print the number of lucky numbers in one line.
Do use the %lld specifier or cin/ cout stream to read or write 64-bit integers in С++.
Sample Input
1 48
1 484848
Sample Output

Problem Setter : Yang Xiao