CF55D.Beautiful numbers
省选/NOI-
通过率:0%
时间限制:4.00s
内存限制:256MB
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 t (1 ≤ t ≤ 10). Each of the next t lines contains two natural numbers l__i and r__i (1 ≤ l__i ≤ r__i ≤ 9 ·1018).
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).
输入的第一行包含测试用例的数量 t(1 ≤ t ≤ 10)。接下来的 t 行中,每行包含两个自然数 li 和 ri(1 ≤ li ≤ ri ≤ 9 ⋅ 1018)。
请注意,在 C++ 中读取或写入 64 位整数时,请勿使用 %lld 格式说明符。推荐使用 cin(也可使用 %I64d)。
输出格式
Output should contain t numbers — answers to the queries, one number per line — quantities of beautiful numbers in given intervals (from l__i to r__i, inclusively).
输出应包含 t 个数字——即各查询的答案,每行一个数字——表示给定区间(从 l__i 到 r__i,含端点)内优美数的个数。
输入输出样例
输入#1
1 1 9
输出#1
9
输入#2
1 12 15
输出#2
2
输入解题思路,AI测评打分。不知道怎么写?