传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5179
beautiful number
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 176 Accepted Submission(s): 104
Problem Description
Let
A=∑ni=1ai∗10n−i(1≤ai≤9)(
n is the number of
A's digits). We call
A as “beautiful number” if and only if
a[i]≥a[i+1] when
1≤i<n and
a[i]mod
a[j]=0 when
1≤i≤n,i<j≤n(Such as 931 is a "beautiful number" while 87 isn't).
Could you tell me the number of “beautiful number” in the interval
[L,R](including L and R)?
Input
The fist line contains a single integer
T(about 100), indicating the number of cases.
Each test case begins with two integers
L,R(1≤L≤R≤109).
Output
For each case, output an integer means the number of “beautiful number”.
Sample Input
2 1 11 999999993 999999999
Sample Output
Source
BestCoder Round #31
Recommend
hujie | We have carefully selected several similar problems for you: 5181 5180 5177 5176 5175
好吧。。让我们把这道题先在自己电脑上算出来。然后把结果丢到数组里查询。
代码(本地离线处理):
#include
#include
#include
#include
#include
#include
#include
AC代码:
#include
#include
#include
#include
#include
#include
#include