#DP1024. Classy Numbers
Classy Numbers
Classy Numbers
题面翻译
定义一个数字是“好数”,当且仅当它的十进制表示下有不超过 个 之间的数字。
举个例子: 是“好数”,然而 不是
给定 ,问有多少个 使得 ,且 是“好数”
一共有 组数据,对于每次的询问,输出一行一个整数表示答案
题目描述
Let's call some positive integer classy if its decimal representation contains no more than non-zero digits. For example, numbers , , are classy and numbers , , are not.
You are given a segment . Count the number of classy integers such that .
Each testcase contains several segments, for each of them you are required to solve the problem separately.
输入格式
The first line contains a single integer ( ) — the number of segments in a testcase.
Each of the next lines contains two integers and ( ).
输出格式
Print lines — the -th line should contain the number of classy integers on a segment .
样例 #1
样例输入 #1
4
1 1000
1024 1024
65536 65536
999999 1000001
样例输出 #1
1000
1
0
2