当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3909:Lucky numbers

题目描述
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.
输入解释
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 must contain T lines – answers for the test cases.
输入样例
4
1 2
88 99
112 112
1 100
输出样例
0
0
1
10
提示
Constrains:
1 ≤ T ≤ 7777,
1 ≤ A ≤ B ≤ 1000000000000 (1012).
Hint:
Very lucky numbers for the last case of the sample input are: 4, 7, 16, 28, 44, 47, 49, 64, 74 and 77.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3909

最后修改于 2020-10-29T07:15:08+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536