#P3754. 首都效应
首都效应
Description
Jace is the president of Alara. Like the president of country Q, due to war, he must travel by car to Yugo’s capital. The accompanying recorder Tezzeret is responsible for assessing Yugo’s true strength. His task is to count the number of houses in the cities along the way.
The cities of Yugo are already numbered. While counting, he discovered a rule: split the city number into several consecutive “digit runs” (each run consists of the same digit). For each run, multiply that digit by the square of the run’s length, then sum all these values to obtain the number of houses in that city. Example: for city , the number of houses is .
Tezzeret was told to compute the total number of houses along the route (from city , where they enter Yugo, up to the capital city ), but the computation is too heavy. Can you use a PC to help him solve this large-scale calculation?
Input Format
One line with two integers , representing the first city upon entering Yugo and the capital city, respectively.
Output Format
One line with one integer, the total number of houses.
100 111
68
233 233
14
1 9
45
Hint
In Sample , the total number of houses is: $1\times1^2+1\times1^2+1\times1^2+2\times1^2+1\times1^2+3\times1^2+\ldots+1\times1^2+9\times1^2+1\times2^2+1\times3^2=68$.
Translated by ChatGPT 5
京公网安备 11011102002149号