CF1036C.Classy Numbers

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Let's call some positive integer classy if its decimal representation contains no more than 33 non-zero digits. For example, numbers 44 , 200000200000 , 1020310203 are classy and numbers 42314231 , 102306102306 , 72774200007277420000 are not.

You are given a segment [L;R][L; R] . Count the number of classy integers xx such that LxRL \le x \le 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 TT ( 1T1041 \le T \le 10^4 ) — the number of segments in a testcase.

Each of the next TT lines contains two integers LiL_i and RiR_i ( 1LiRi10181 \le L_i \le R_i \le 10^{18} ).

输出格式

Print TT lines — the ii -th line should contain the number of classy integers on a segment [Li;Ri][L_i; R_i] .

输入输出样例

  • 输入#1

    4
    1 1000
    1024 1024
    65536 65536
    999999 1000001
    

    输出#1

    1000
    1
    0
    2
    
首页