CF1036C.Classy Numbers
普及+/提高
通过率:0%
时间限制:3.00s
内存限制:256MB
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.
我们称某个正整数为“优雅数”(classy),如果其十进制表示中至多包含 3 个非零数字。例如,数字 4、200000、10203 是优雅数,而数字 4231、102306、7277420000 不是。
给定一个区间 [L;R]。请计算满足 L≤x≤R 的优雅数 x 的个数。
每个测试用例包含多个区间,对每个区间你都需要独立求解该问题。
输入格式
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).
第一行包含一个整数 T(1≤T≤104)—— 表示测试用例中线段的数量。
接下来的 T 行,每行包含两个整数 Li 和 Ri(1≤Li≤Ri≤1018)。
输出格式
Print T lines — the i-th line should contain the number of classy integers on a segment [Li;Ri].
输出 T 行——第 i 行应包含区间 [Li;Ri] 中“优雅整数”(classy integers)的个数。
输入输出样例
输入#1
4 1 1000 1024 1024 65536 65536 999999 1000001
输出#1
1000 1 0 2
输入解题思路,AI测评打分。不知道怎么写?