#P8577. [CoE R5] 暴龙的白菜
[CoE R5] 暴龙的白菜
Background
The T-Rex loves eating Chinese cabbage.
Problem Description
You are given a string formed by concatenating, in order:
copy of , copies of , copies of , copies of , copies of , copies of , copies of , copies of , copies of , copies of , and so on.
For each query, find the sum of the digits from position to position in the string.
Input Format
The input contains multiple groups of testdata.
The first line contains a positive integer .
The next queries each contain two positive integers .
Output Format
Output lines, each containing one integer representing the answer.
4
5 9
46 50
114 514
19 19810
18
3
1134
74924
Hint
Sample Explanation
The string is:
$$\texttt{12233344445555566666677777778888888899999999910101010101010101010}\cdots\cdots$$For the first query, the sum of the digits from position to position is .
For the second query, the sum of the digits from position to position is .
Constraints
This problem uses bundled tests.
- , ;
- , ;
- , ;
- no special constraints.
For of the data, , .
Translated by ChatGPT 5