所以。。。大家说的LOJ到底是LightOJ还是LibreOJ?= =!
终于有道比较清爽的数位DP题了。。虽然写得依旧很慢就是。。qaq
统计0的个数。。。这个需要稍微分一下是不是前导0,标记一下前面有没有非0数即可,然后。。就是在统计数的个数时太想当然了。。以为是10^n什么的。。计算上界的时候可不是这样的耶。。所以要边转移边统计。。
用cin的原因是。。。用%llu输入时编译器不造为什么有warning。。。还是菜蛙qaq
1140 - How Many Zeroes?
| Forum |
Time Limit: 2 second(s) | Memory Limit: 32 MB |
Jimmy writes down the decimal representations of all naturalnumbers between and including m and n, (m ≤ n). How many zeroeswill he write down?
Input
Input starts with an integer T (≤ 11000),denoting the number of test cases.
Each case contains two unsigned 32-bit integers m andn, (m ≤ n).
Output
For each case, print the case number and the number of zeroeswritten down by Jimmy.
Sample Input | Output for Sample Input |
5 10 11 100 200 0 500 1234567890 2345678901 0 4294967295 | Case 1: 1 Case 2: 22 Case 3: 92 Case 4: 987654304 Case 5: 3825876150 |
Special Thanks: Jane Alam Jan (Description, Solution, Dataset)