/* Topic content:
YF does not love fame and fortune, so he neither likes 6, nor does he like 8. His lucky numbers are 4 and 7. If a number contains only 4 and 7, he thinks the number is his lucky number.
Now you have two positive integers, a, a, a, a, a number of lucky numbers between A and B, including a, b itself.
Enter a description
The first line enters the number n, which indicates that there are n groups of AB
Line 2nd starts with a set of a B and a space separated by each line.
Output description
Each line outputs a number, that is, the number of lucky numbers between A and B.
Input sample
3
11 20
4 7
1 10
Output sample
0
2
2
*/
#include <iostream>
using namespace Std;
int lucky[10000005]; Attention to size, small has always been the answer wrong
void Countlucky () {
for (int i = 1; I <= 10000000; i++) {
int C, D, E, F, G, h, y = i;
int flag = 1;
if (y% 10 = = 0)
Flag = 0;
while (y% && flag) {
c = y% 10; Y/= 10;
if (c! = 4 && c! = 7)
Flag = 0;
}
if (flag && y = = 0)//101 y = 10
Lucky[i] = 1;
c = y% 10; Y/= 10;
d = y% 10; Y/= 10;
E = y% 10; Y/= 10;
f = y% 10; Y/= 10;
g = y% 10; Y/= 10;
h = y% 10; Y/= 10;
if (I < 10)
LUCKY[4] = lucky[7] = 1;
if (I < 100) {
if ((c = = 4 | | c = 7) && (d = = 4 | | d = = 7))
Lucky[i] = 1;
// }
if (I < + && (c = = 4 | | c = 7) && (d = = 4 | | d = = 7) && (E = = 4 | | e = = 7))
Lucky[i] = 1;
if (I < 10000 && (c = = 4 | | c = = 7) && (d = = 4 | | d = = 7) && (E = = 4 | | e = = 7) && Amp (f = = 4 | | f = = 7))
Lucky[i] = 1;
if (I < 100000 && (c = = 4 | | c = = 7) && (d = = 4 | | d = = 7) && (E = = 4 | | e = = 7) & & (F = = 4 | | f = 7)
&& (g = = 4 | | g = = 7))
Lucky[i] = 1;
if (I < 100000 && (c = = 4 | | c = = 7) && (d = = 4 | | d = = 7) && (E = = 4 | | e = = 7) & & (F = = 4 | | f = 7)
&& (g = = 4 | | g = 7) && (h = = 4 | | h = = 7))
Lucky[i] = 1;
Lucky[i] + = lucky[i-1];
}
}
int main () {
Ios::sync_with_stdio (FALSE);
int n;
CIN >> N;
Countlucky ();
while (n--) {
int A, B;
Cin >> a >> b;
cout << Lucky[b]-lucky[a-1] << Endl;
// }
return 0;
}
15-Lucky Array 4, 7