AT_arc224_a.Attach 00

普及-

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

  • nn is a multiple of KK.
  • In the decimal representation of nn, 0 appears two or more times consecutively.

TT test cases are given; solve each of them.

求满足以下两个条件的最小正整数 nn:

  • nn 是 KK 的倍数;
  • nn 的十进制表示中,数字 0 至少连续出现两次。

共给出 TT 组测试用例,请对每组用例求解。

输入格式

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

TT
case1\mathrm{case}_1
⋮\vdots
caseT\mathrm{case}_T

Each test case is given in the following format:

KK

输入从标准输入给出,格式如下,其中 casei\mathrm{case}_i 表示第 ii 个测试用例:

TT
case1\mathrm{case}_1
⋮\vdots
caseT\mathrm{case}_T

每个测试用例的格式如下:

KK

输出格式

Output TT lines. The ii-th line should contain the answer for the ii-th test case.

输出 TT 行。第 ii 行应包含第 ii 个测试用例的答案。

输入输出样例

  • 输入#1

    3
    17
    6801
    998244353

    输出#1

    1003
    34005
    16970154001

说明/提示

Sample 1 Explanation:
This input contains three test cases.

For the first test case, the minimum value satisfying the conditions is 1003 (=17×59)1003\ (= 17 \times 59).

For the second test case, the minimum value satisfying the conditions is 34005 (=6801×5)34005\ (= 6801 \times 5). Note that 20403 (=6801×3)20403\ (= 6801 \times 3) does not satisfy the condition.

For the third test case, the minimum value satisfying the conditions is 16970154001 (=998244353×17)16970154001\ (= 998244353 \times 17). As this shows, the answer may not fit in a 3232-bit integer.

Constraints

  • 1≤T≤1051 \leq T \leq 10^5
  • 1≤K≤1091 \leq K \leq 10^9
  • All input values are integers.

样例 1 解释:
该输入包含三个测试用例。

对于第一个测试用例,满足条件的最小值为 1003 (=17×59)1003\ (= 17 \times 59)。

对于第二个测试用例,满足条件的最小值为 34005 (=6801×5)34005\ (= 6801 \times 5)。注意,20403 (=6801×3)20403\ (= 6801 \times 3) 不满足条件。

对于第三个测试用例,满足条件的最小值为 16970154001 (=998244353×17)16970154001\ (= 998244353 \times 17)。如本例所示,答案可能无法用 32 位整数表示。

约束条件

  • 1≤T≤1051 \leq T \leq 10^5
  • 1≤K≤1091 \leq K \leq 10^9
  • 所有输入值均为整数。

输入解题思路,AI测评打分。不知道怎么写?

首页