F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

beautiful number

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1607    Accepted Submission(s): 1036


Problem Description
Let $A = \sum_{i=1}^{n}a_i * {10}^{n-i}(1\leq a_i \leq 9)$($n$ is the number of $A$'s digits). We call $A$ as ˇ°beautiful numberˇ± if and only if $a[i] \geq a[i+1]$ when $1 \leq i<n$ and $a[i]$ mod $a[j]=0$ when $1 \leq i \leq n,i<j \leq 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 \leq L \leq R \leq {10}^{9})$.
 

Output
For each case, output an integer means the number of ˇ°beautiful numberˇ±.
 

Sample Input
2 1 11 999999993 999999999
 

Sample Output
10 2
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-06-22 18:36:12, Gzip enabled