printРабочее место участника

printЗадачи

1648. Self-product

Ограничения: время – 2s/4s, память – 64MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод copy
Послать решение Blockly Посылки Темы Где Обсудить (0)

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 for given two positive integers `A` and `B` calculates the number of positive integers whose self-product is between `A` and `B`, inclusive.
Input
The first and only line contains two integers `A` and `B` (`1\ ≤\ A\ ≤\ B\ <\ 10^18`).
Output
Output should consist of a single integer, the number of positive integers whose self-product is between `A` and `B`.

Sample Input 1

20 30

Sample Output 1

2

Sample Input 2

145 192

Sample Output 2

4

Sample Input 3

2224222 2224222

Sample Output 3

1
Source: Croatian olympiad in informatics, April 2008
loading