A. k-rounding

Codeforces
IDCF861A
Time1000ms
Memory256MB
Difficulty
mathnumber theory
English · Original
Chinese · Translation
Formal · Original
For a given positive integer _n_ denote its _k_\-rounding as the minimum positive integer _x_, such that _x_ ends with _k_ or more zeros in base 10 and is divisible by _n_. For example, 4\-rounding of 375 is 375·80 = 30000. 30000 is the minimum integer such that it ends with 4 or more zeros and is divisible by 375. Write a program that will perform the _k_\-rounding of _n_. ## Input The only line contains two integers _n_ and _k_ (1 ≤ _n_ ≤ 109, 0 ≤ _k_ ≤ 8). ## Output Print the _k_\-rounding of _n_. [samples]
对于给定的正整数 $n$,定义其 $k$-rounding 为最小的正整数 $x$,使得 $x$ 在十进制下以 $k$ 个或更多零结尾,且能被 $n$ 整除。 例如,$375$ 的 $4$-rounding 是 $375·80 = 30000$。$30000$ 是满足以 $4$ 个或更多零结尾且能被 $375$ 整除的最小整数。 编写一个程序,计算 $n$ 的 $k$-rounding。 输入仅一行,包含两个整数 $n$ 和 $k$($1 ≤ n ≤ 10^9$,$0 ≤ k ≤ 8$)。 请输出 $n$ 的 $k$-rounding。 ## Input 输入仅一行,包含两个整数 $n$ 和 $k$($1 ≤ n ≤ 10^9$,$0 ≤ k ≤ 8$)。 ## Output 请输出 $n$ 的 $k$-rounding。 [samples]
**Definitions** Let $ n \in \mathbb{Z}^+ $, $ k \in \mathbb{Z} $ with $ 0 \leq k \leq 8 $. The $ k $-rounding of $ n $ is the smallest positive integer $ x $ such that: - $ n \mid x $, - $ x \equiv 0 \pmod{10^k} $. **Objective** Find $ x = \min \{ y \in \mathbb{Z}^+ \mid n \mid y \text{ and } 10^k \mid y \} $. **Solution Formulation** $$ x = \frac{\mathrm{lcm}(n, 10^k)}{\gcd(n, 10^k)} \cdot \gcd(n, 10^k) = \mathrm{lcm}(n, 10^k) $$ Thus, $$ x = \mathrm{lcm}(n, 10^k) $$
Samples
Input #1
375 4
Output #1
30000
Input #2
10000 1
Output #2
10000
Input #3
38101 0
Output #3
38101
Input #4
123456789 8
Output #4
12345678900000000
API Response (JSON)
{
  "problem": {
    "name": "A. k-rounding",
    "description": {
      "content": "For a given positive integer _n_ denote its _k_\\-rounding as the minimum positive integer _x_, such that _x_ ends with _k_ or more zeros in base 10 and is divisible by _n_. For example, 4\\-rounding o",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF861A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "For a given positive integer _n_ denote its _k_\\-rounding as the minimum positive integer _x_, such that _x_ ends with _k_ or more zeros in base 10 and is divisible by _n_.\n\nFor example, 4\\-rounding o...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "对于给定的正整数 $n$,定义其 $k$-rounding 为最小的正整数 $x$,使得 $x$ 在十进制下以 $k$ 个或更多零结尾,且能被 $n$ 整除。\n\n例如,$375$ 的 $4$-rounding 是 $375·80 = 30000$。$30000$ 是满足以 $4$ 个或更多零结尾且能被 $375$ 整除的最小整数。\n\n编写一个程序,计算 $n$ 的 $k$-rounding。\n\n输...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $, $ k \\in \\mathbb{Z} $ with $ 0 \\leq k \\leq 8 $.  \nThe $ k $-rounding of $ n $ is the smallest positive integer $ x $ such that:  \n- $ n \\mid x $,  \n- $ x \\...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments