#6305. [ICPC 2023 Seoul R] Special Numbers
[ICPC 2023 Seoul R] Special Numbers
[ICPC 2023 Seoul R] Special Numbers
题目描述
Number theorist Dr. J is attracted by the beauty of numbers. When we are given a natural number $a=a_1a_2\dots a_n$ of $n$ digits and a natural number $k$, $a$ is called $k$-special if the product of all the digits of $a$, i.e. $a_1a_2\dots a_n$ is divisible by $k$. Note that the number $0$ is always divisible by a natural number.For example, if and , then the product of all the digits of , is divisible by , so the number is -special. If and , then the product of all the digits of , is not divisible by , so the number is not -special.
Given three natural numbers , and , write a program to output where is the number of -special numbers among numbers in the range .
输入格式
Your program is to read from standard input. The input has one line containing three integers, $k,L$, and $R$($1 \le k \le 10^{17}, 1 \le L\le R\le 10^{20} $).输出格式
Your program is to write to standard output. Print exactly one line. The line should contain $z\bmod 10^9+7$ where $z$ is the number of $k$-special numbers among the numbers in the range $[L,R]$, where both $L$ and $R$ are inclusive in the range.5 1 20
4
5 50 100
19
15 11 19
0