QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#606946#8932. BingoUESTC_NLNS#WA 17ms10636kbPython3721b2024-10-03 13:10:092024-10-03 13:10:10

Judging History

你现在查看的是最新测评结果

  • [2024-10-03 13:10:10]
  • 评测
  • 测评结果:WA
  • 用时:17ms
  • 内存:10636kb
  • [2024-10-03 13:10:09]
  • 提交

answer

t = int(input())
for i in range(t):
    n1, m1 = input().split()
    n, m = map(int, [n1, m1])
    if n < m:
        print(m)
        continue
    a1 = (n // m + 1) * m

    n += 1
    n1 = str(n)
    if m1 in n1:
        print(n1)
        continue

    lm = len(m1)
    n21 = n1[: -2 * lm - 3]
    n2 = n1[-2 * lm - 3 :]
    n2i = int(n2)
    # print(n2)
    a2 = 10**40
    for i in range(0, len(n2) - lm + 1):
        a3 = n2[:i] + m1 + "0" * (len(n2) - lm - i)
        print(a3)
        a3 = int(a3)
        if a3 > n2i:
            a2 = min(a2, a3)

    a2 = int(n21 + str(a2))
    print(min(a1, a2))
"""
6
7 3
12 3
9 10
249 51
1369 37
2 1
"""
"""
1
9999453887421 434 
"""

详细

Test #1:

score: 0
Wrong Answer
time: 17ms
memory: 10636kb

input:

6
7 3
12 3
9 10
249 51
1369 37
2 1

output:

3
9
13
10
510
251
251
1370
1
3

result:

wrong answer 1st lines differ - expected: '9', found: '3'