一道ACM题目-无思路,该如何解决

一道ACM题目-无思路题目描述如下:Description:Let D(X) denote the sum of digits of the positive intege

一道ACM题目-无思路
题目描述如下:
Description:
Let D(X) denote the sum of digits of the positive integer X. For example, D(4007) = 4 + 0 + 0 + 7 = 11. 

Take any positive integer X, and let Y = X / D(X). If Y is an integer, we say that Y is the parent of X (and that X is a child of Y). For example, if X=12 then X / D(X) = 12 / (1+2) = 4, hence 4 is the parent of 12. 

Note that multiple numbers can have the same parent. For example, 4 is also the parent of 36, as 36/(3+6) = 36/9 = 4. 

We say that a number Y is childless if there is no positive integer X such that Y is the parent of X. 

You are given two ints A and B. Find the count of all childless numbers that lie between A and B, inclusive. 

Input:
Several Test case Every case contain two integer A and B. A will be between 1 and 1,000,000,000, inclusive. B will be between A and 1,000,000,000, inclusive. B-A will be between 0 and 10,000, inclusive. 
Output:
The number of all childless numbers that lie between A and B 
Sample Input:
4 7
61 65
Sample Output:
0
3

求高手帮忙给个思路

[解决办法]
>B-A will be between 0 and 10,000
于是可以枚举这一万个数,检测它们是否是childless。检测办法是枚举D(X)看D(D(X)*Y)是否等于D(X)。如果没有一个是的话那就是childless了。估计D(X)枚举到100应该够了。