Simple Math 2

AtCoder
IDarc111_a
Time2000ms
Memory256MB
Difficulty
Given positive integers $N$ and $M$, find the remainder when $\lfloor \frac{10^N}{M} \rfloor$ is divided by $M$. What is $\lfloor x \rfloor$? $\lfloor x \rfloor$ denotes the greatest integer not exceeding $x$. For example: * $\lfloor 2.5 \rfloor = 2$ * $\lfloor 3 \rfloor = 3$ * $\lfloor 9.9999999 \rfloor = 9$ * $\lfloor \frac{100}{3} \rfloor = \lfloor 33.33... \rfloor = 33$ ## Constraints * $1 \leq N \leq 10^{18}$ * $1 \leq M \leq 10000$ ## Input Input is given from Standard Input in the following format: $N$ $M$ [samples]
Samples
Input #1
1 2
Output #1
1

We have $\lfloor \frac{10^1}{2} \rfloor = 5$, so we should print the remainder when $5$ is divided by $2$, that is, $1$.
Input #2
2 7
Output #2
0
Input #3
1000000000000000000 9997
Output #3
9015
API Response (JSON)
{
  "problem": {
    "name": "Simple Math 2",
    "description": {
      "content": "Given positive integers $N$ and $M$, find the remainder when $\\lfloor \\frac{10^N}{M} \\rfloor$ is divided by $M$. What is $\\lfloor x \\rfloor$? $\\lfloor x \\rfloor$ denotes the greatest integer not excee",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc111_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Given positive integers $N$ and $M$, find the remainder when $\\lfloor \\frac{10^N}{M} \\rfloor$ is divided by $M$.\nWhat is $\\lfloor x \\rfloor$? $\\lfloor x \\rfloor$ denotes the greatest integer not excee...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments