Mirrored

AtCoder
IDarc075_d
Time2000ms
Memory256MB
Difficulty
For a positive integer $n$, we denote the integer obtained by reversing the decimal notation of $n$ (without leading zeroes) by $rev(n)$. For example, $rev(123) = 321$ and $rev(4000) = 4$. You are given a positive integer $D$. How many positive integers $N$ satisfy $rev(N) = N + D$? ## Constraints * $D$ is an integer. * $1 ≤ D < 10^9$ ## Input Input is given from Standard Input in the following format: $D$ [samples]
Samples
Input #1
63
Output #1
2

There are two positive integers $N$ such that $rev(N) = N + 63$: $N = 18$ and $29$.
Input #2
75
Output #2
0

There are no positive integers $N$ such that $rev(N) = N + 75$.
Input #3
864197532
Output #3
1920
API Response (JSON)
{
  "problem": {
    "name": "Mirrored",
    "description": {
      "content": "For a positive integer $n$, we denote the integer obtained by reversing the decimal notation of $n$ (without leading zeroes) by $rev(n)$. For example, $rev(123) = 321$ and $rev(4000) = 4$. You are giv",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc075_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "For a positive integer $n$, we denote the integer obtained by reversing the decimal notation of $n$ (without leading zeroes) by $rev(n)$. For example, $rev(123) = 321$ and $rev(4000) = 4$.\nYou are giv...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments