#K5631. Sum of Minimum Palindromic Numbers
Sum of Minimum Palindromic Numbers
Sum of Minimum Palindromic Numbers
In this problem, you are given two integers, a and b (with a ≤ b). For each number x in the range [a, b], you need to find the smallest palindromic number that is greater than or equal to x. A palindromic number is a number that reads the same backward as forward. Your task is to compute and output the sum of these minimal palindromic numbers.
For example, if a = 13 and b = 20, the minimal palindromic number for 13 is 22 (since 14, 15, …, 21 are not palindromic), and similarly for other numbers. The final answer is the sum of all these palindromic numbers.
inputFormat
The input consists of a single line containing two integers a and b separated by a space, where a ≤ b.
outputFormat
Output a single integer, which is the sum of the smallest palindromic numbers that are greater than or equal to each number in the range [a, b].## sample
13 20
176
</p>