ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

The number + its inverted number <= S
Posted by Sergio86 26 Dec 2024 09:31
For a positive integer x, we define R(x) as a number equal to the inverted x in decimal notation. For example, R(123) = 321, R(1) = 1, and R(100500) = 5001.

For a given number S, calculate the number of integers x such that 1 ≤ x and x+R(x) ≤ S.

As an answer, print the remainder of dividing this number by 10^9 + 7.

Input data contains an integer S written without leading zeros (0 < S < 10^100000).

Test: 1000000 Answer: 505449

The idea: the dynamics of the digits of the number?
What other ideas can you suggest?