luogu#P10959. 月之谜

    ID: 10204 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>动态规划 DP搜索记忆化搜索数位 DP

月之谜

Problem Description

If a decimal number can be divided by the sum of its digits, then this number is called a "Moon number".

Given integers LL and RR, you need to compute how many "Moon numbers" there are in the closed interval [L,R][L, R].

Input Format

Multiple sets of testdata. Each set is on one line and contains two integers LL and RR.

Output Format

For each set of data, output one integer per line, representing the number of Moon numbers.

1 100 

33

Hint

Constraints: It is guaranteed that 1L,R<2311 \le L, R < 2^{31}, and there are no more than 30003000 testdata sets in a single test.

Translated by ChatGPT 5