Small Multiple

AtCoder
IDarc084_b
Time2000ms
Memory256MB
Difficulty
Find the smallest possible sum of the digits in the decimal notation of a positive multiple of $K$. ## Constraints * $2 \leq K \leq 10^5$ * $K$ is an integer. ## Input Input is given from Standard Input in the following format: $K$ [samples]
Samples
Input #1
6
Output #1
3

$12=6×2$ yields the smallest sum.
Input #2
41
Output #2
5

$11111=41×271$ yields the smallest sum.
Input #3
79992
Output #3
36
API Response (JSON)
{
  "problem": {
    "name": "Small Multiple",
    "description": {
      "content": "Find the smallest possible sum of the digits in the decimal notation of a positive multiple of $K$.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc084_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Find the smallest possible sum of the digits in the decimal notation of a positive multiple of $K$.\n\n## Constraints\n\n*   $2 \\leq K \\leq 10^5$\n*   $K$ is an integer.\n\n## Input\n\nInput is given from Stan...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments