CF55D.Beautiful numbers

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of its nonzero digits. We will not argue with this and just count the quantity of beautiful numbers in given ranges.

输入格式

The first line of the input contains the number of cases tt ( 1<=t<=101<=t<=10 ). Each of the next tt lines contains two natural numbers lil_{i} and rir_{i} ( 1<=li<=ri<=910181<=l_{i}<=r_{i}<=9·10^{18} ).

Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cin (also you may use %I64d).

输出格式

Output should contain tt numbers — answers to the queries, one number per line — quantities of beautiful numbers in given intervals (from lil_{i} to rir_{i} , inclusively).

输入输出样例

  • 输入#1

    1
    1 9
    

    输出#1

    9
    
  • 输入#2

    1
    12 15
    

    输出#2

    2
    
首页