Arithmetic Number

AtCoder
IDabc234_e
Time2000ms
Memory256MB
Difficulty
Let us call a positive integer $n$ that satisfies the following condition an **arithmetic number**. * Let $d_i$ be the $i$\-th digit of $n$ from the top (when $n$ is written in base $10$ without unnecessary leading zeros.) Then, $(d_2-d_1)=(d_3-d_2)=\dots=(d_k-d_{k-1})$ holds, where $k$ is the number of digits in $n$. * This condition can be rephrased into the sequence $(d_1,d_2,\dots,d_k)$ being arithmetic. * If $n$ is a $1$\-digit integer, it is assumed to be an arithmetic number. For example, $234,369,86420,17,95,8,11,777$ are arithmetic numbers, while $751,919,2022,246810,2356$ are not. Find the smallest arithmetic number not less than $X$. ## Constraints * $X$ is an integer between $1$ and $10^{17}$ (inclusive). ## Input Input is given from Standard Input in the following format: $X$ [samples]
Samples
Input #1
152
Output #1
159

The smallest arithmetic number not less than $152$ is $159$.
Input #2
88
Output #2
88

$X$ itself may be an arithmetic number.
Input #3
8989898989
Output #3
9876543210
API Response (JSON)
{
  "problem": {
    "name": "Arithmetic Number",
    "description": {
      "content": "Let us call a positive integer $n$ that satisfies the following condition an **arithmetic number**. *   Let $d_i$ be the $i$\\-th digit of $n$ from the top (when $n$ is written in base $10$ without un",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc234_e"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Let us call a positive integer $n$ that satisfies the following condition an **arithmetic number**.\n\n*   Let $d_i$ be the $i$\\-th digit of $n$ from the top (when $n$ is written in base $10$ without un...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments