P1362 Rabbit Number
Description
Let $S(N)$ denote the sum of the digits of $N$, such as $S(484) = 4+8+4 = 16$, $S(22) = 2+2 = 4$. If a positive integer satisfies $S(x \cdot x) = S(x) \cdot S(x)$, we call it a Rabbit Number. For example, $22$ is a Rabbit Number, because $S(484) = S(22) \cdot S(22)$.
Now, given an interval $[L,R]$, find the number of Rabbit Numbers within this interval.
Input Format
The input consists of a single line with two numbers $L$ and $R$ separated by a space.
Output Format
Output a single line containing one integer, the number of Rabbit Numbers in $[L,R]$.
Explanation/Hint
Constraints: For $100 \%$ of the testdata, $1 \le L \le R \le 10^9$.
Translated by ChatGPT 5