Croatian Olympiad in Informatics 2008
The digit-product of a positive integer is the product of the number's decimal digits. For example, the digit-product of 2612 is 2 · 6 · 1 · 2 = 24.
The self-product of a number is the product of the number and its digit-product. For example, the self-product of 2612 is 2612 · 24 = 62688.
Write a program that, given two positive integers A and B, calculates the number of positive integers whose self-product is between A and B, inclusive.
The first and only line contains two integers A and B (1 ≤ A ≤ B < 1018).
Output should consist of a single integer, the number of positive integers whose twist is between A and B.
In test cases worth a total of 25 points, A and B will be at most 108.
In test cases worth another 15, A and B will be at most 1012.
Clarification of example 2: The self-products of numbers 19, 24, 32 and 41 are in order 171, 192, 192 and 164.
Point Value: 30 (partial)
Time Limit: 1.00s
Memory Limit: 64M
Added: Aug 12, 2013
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3