题目链接:https://cn.vjudge.net/problem/HDU-4389 Here is a function f(x): int f ( int x ) { if ( x == 0 ) return 0; return f ( x / 10 ) + x % 10; }
Now, you want to know, in a given interval [A, B] (1 <= A <= B <= 10 9), how many integer x that mod f(x) equal to 0.
Input
The first line has an integer T (1 <= T <= 50), indicate the number of test cases.
Each test case has two integers A, B.
Output
For each test case, output only one line containing the case number and an integer indicated the number of x.
Sample Input
2 1 10 11 20
Sample Output
Case 1: 10 Case 2: 3
题意:
f(x)为x的各位数之和。
求[A,B]范围内x%f(x)==0的x的个数
用dp[pos][sum][x][mod]来表示 第pos位之前各位数字之和为sum的数 除以x(也就是题意中的f(x