AtCoder Regular Contest-- 224
A
补上00
Attach 00
AtCoder
⌀ 148
原题
←B →

补上00AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

Find the minimum value of a positive integer $n$ satisfying the following two conditions.

求满足以下两个条件的正整数 $n$ 的最小值。AI (CI翻译)

  • $n$ is a multiple of $K$.
  • In the decimal representation of $n$, 0 appears two or more times consecutively.
  • $n$ 是 $K$ 的倍数。
  • $n$ 的十进制表示中,至少有两个连续的 0。
AI (CI翻译)

$T$ test cases are given; solve each of them.

给定 $T$ 组测试用例,请分别求解。AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $1 \leq T \leq 10^5$
  • $1 \leq K \leq 10^9$
  • All input values are integers.
  • $1 \leq T \leq 10^5$
  • $1 \leq K \leq 10^9$
  • 所有输入值均为整数。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input is given from Standard Input in the following format, where $\mathrm{case}_i$ denotes the $i$-th test case:

输入从标准输入按以下格式给出,其中 $\mathrm{case}_i$ 表示第 $i$ 组测试用例:AI (CI翻译)

T
\mathrm{case}_1
\vdots
\mathrm{case}_T

T
\mathrm{case}_1
\vdots
\mathrm{case}_T
AI (CI翻译)

Each test case is given in the following format:

每组测试用例按以下格式给出:AI (CI翻译)

K

K
AI (CI翻译)

Output

输出格式

AI (CI翻译)

Output $T$ lines. The $i$-th line should contain the answer for the $i$-th test case.

输出 $T$ 行。第 $i$ 行应包含第 $i$ 组测试用例的答案。AI (CI翻译)

样例

Input #1
3
17
6801
998244353
Output #1
1003
34005
16970154001
This input contains three test cases. For the first test case, the minimum value satisfying the conditions is $1003\ (= 17 \times 59)$. For the second test case, the minimum value satisfying the conditions is $34005\ (= 6801 \times 5)$. Note that $20403\ (= 6801 \times 3)$ does not satisfy the condition. For the third test case, the minimum value satisfying the conditions is $16970154001\ (= 998244353 \times 17)$. As this shows, the answer may not fit in a $32$-bit integer.
题目信息
题号
arc224_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。