Number of Digits

AtCoder
IDarc090_d
Time2000ms
Memory256MB
Difficulty
For a positive integer $n$, let us define $f(n)$ as the number of digits in base $10$. You are given an integer $S$. Count the number of the pairs of positive integers $(l, r)$ ($l \leq r$) such that $f(l) + f(l + 1) + ... + f(r) = S$, and find the count modulo $10^9 + 7$. ## Constraints * $1 \leq S \leq 10^8$ ## Input Input is given from Standard Input in the following format: $S$ [samples]
Samples
Input #1
1
Output #1
9

There are nine pairs $(l, r)$ that satisfies the condition: $(1, 1)$, $(2, 2)$, $...$, $(9, 9)$.
Input #2
2
Output #2
98

There are $98$ pairs $(l, r)$ that satisfies the condition, such as $(1, 2)$ and $(33, 33)$.
Input #3
123
Output #3
460191684
Input #4
36018
Output #4
966522825
Input #5
1000
Output #5
184984484
API Response (JSON)
{
  "problem": {
    "name": "Number of Digits",
    "description": {
      "content": "For a positive integer $n$, let us define $f(n)$ as the number of digits in base $10$. You are given an integer $S$. Count the number of the pairs of positive integers $(l, r)$ ($l \\leq r$) such that ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc090_d"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "For a positive integer $n$, let us define $f(n)$ as the number of digits in base $10$.\nYou are given an integer $S$. Count the number of the pairs of positive integers $(l, r)$ ($l \\leq r$) such that ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments