QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#789882 | #8932. Bingo | _fcy_# | WA | 304ms | 10648kb | Python3 | 688b | 2024-11-27 22:25:22 | 2024-11-27 22:25:29 |
Judging History
answer
def solve():
N, ms = input().strip().split(" ")
n, m = int(N), int(ms)
a = (n // m + 1) * m
ns = str(n + 1)
if ms in ns:
a = min(a, int(ns))
print(a)
return
for i in range(max(0,len(ns)-2*len(ms)), len(ns)-len(ms)+1):
v = int(ns[len(ns) - len(ms) - i : len(ns) - i])
if v < m:
s = ns[: len(ns) - len(ms) - i] + ms + "0" * i
a = min(a, int(s))
if v == m:
s = ns[: len(ns) - len(ms) - i] + ms + ns[len(ns) - i :]
a = min(a, int(s))
print(a)
import sys
sys.set_int_max_str_digits(1000010)
T = int(input())
while T != 0:
T -= 1
solve()
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 14ms
memory: 10540kb
input:
6 7 3 12 3 9 10 249 51 1369 37 2 1
output:
9 13 10 251 1370 3
result:
ok 6 lines
Test #2:
score: -100
Wrong Answer
time: 304ms
memory: 10648kb
input:
100000 3196282243 28 7614814237 33 2814581084 97 1075124401 58 7822266214 100 1767317768 31 7189709841 75 9061337538 69 6552679231 38 9946082148 18 5497675062 54 7787300351 65 4310767261 68 4811341953 100 3265496130 31 8294404054 62 2845521744 90 1114254672 26 6442013672 13 3744046866 40 3289624367 ...
output:
3196282244 7614814251 2814581100 1075124424 7822266300 1767317769 7189709850 9061337577 6552679264 9946082160 5497675063 7787300365 4310767316 4811342000 3265496131 8294404082 2845521810 1114254674 6442013673 3744046867 3289624425 6477935360 1292587554 5504674742 2898829200 7882736025 2846033436 923...
result:
wrong answer 3rd lines differ - expected: '2814581097', found: '2814581100'