Nộp bài  Các bài nộp  Làm tốt nhất  Về danh sách bài 
MSE08G  Another Lucky Numbers 
English  Vietnamese 
John has recently arrived in Bucharest for the South Eastern European Regional Contest. John is famous for his theory of lucky numbers. That’s why all the contestants and spectators are very happy. According to that theory 4 and 7 are lucky digits, and all the other digits are not lucky. A lucky number is a number that contains only lucky digits in decimal notation. A very lucky number is a number that can be expressed as a product of several lucky numbers. A lucky number by itself is considered to be very lucky. For example, numbers 47, 49, 112 are very lucky.
Your task is to calculate the number of very lucky numbers that are not less than A and not greater than B. Of course, numbers A and B are given by John.
Input
The first line of the input contains a single integer T – a number of test cases. Each of the next T lines contains two integers separated by a single space – A and B.
Output
Output must contain T lines – answers for the test cases.
Constraints:
1 ≤ T ≤ 7777,
1 ≤ A ≤ B ≤ 1000000000000 (10^12).
Sample
Input : 4 1 2 88 99 112 112 1 100 Output: 0 0 1 10
Hint: Very lucky numbers for the last case are 4, 7, 16, 28, 44, 47, 49, 64, 74 and 77.
Được gửi lên bởi:  psetter 
Ngày:  20090410 
Thời gian chạy:  1s1.018s 
Giới hạn mã nguồn:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Ngôn ngữ cho phép:  Tất cả ngoại trừ: ERL GOSU JSRHINO NODEJS PERL6 PYPY RUST SED VB.NET 
Nguồn bài:  Southeastern European 2008 
hide comments
20150908 14:22:41
https://thewizard6296.wordpress.com/2015/09/04/5/ 

20150318 08:16:47 Nï¿½ng Dï¿½n John
va tat ca chi la "chay qua lau" hoac "ket qua sai" !! *eo 

20100607 13:03:50 Cao Viên Viên
:)) Last edit: 20100607 13:07:37 

20100607 04:37:54 Cao Viên Viên
Zzz 

20100517 23:20:58 ~!(*(@*!@^&
sieu nhan xanh vs sieu nhan do copy code cua nhau nhe' ^^. 