CF1036C.Classy Numbers
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Let's call some positive integer classy if its decimal representation contains no more than 3 non-zero digits. For example, numbers 4 , 200000 , 10203 are classy and numbers 4231 , 102306 , 7277420000 are not.
You are given a segment [L;R] . Count the number of classy integers x such that L≤x≤R .
Each testcase contains several segments, for each of them you are required to solve the problem separately.
输入格式
The first line contains a single integer T ( 1≤T≤104 ) — the number of segments in a testcase.
Each of the next T lines contains two integers Li and Ri ( 1≤Li≤Ri≤1018 ).
输出格式
Print T lines — the i -th line should contain the number of classy integers on a segment [Li;Ri] .
输入输出样例
输入#1
4 1 1000 1024 1024 65536 65536 999999 1000001
输出#1
1000 1 0 2