結果

問題 No.2455 Numbers Dictionary
ユーザー mymelochanmymelochan
提出日時 2023-09-03 03:55:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,231 bytes
コンパイル時間 449 ms
コンパイル使用メモリ 87,204 KB
実行使用メモリ 80,240 KB
最終ジャッジ日時 2023-09-03 03:56:20
合計ジャッジ時間 7,128 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 97 ms
71,424 KB
testcase_02 AC 220 ms
78,884 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 213 ms
78,728 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 208 ms
78,148 KB
testcase_18 AC 175 ms
78,136 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#############################################################

import sys
sys.setrecursionlimit(10**7)

from heapq import heappop,heappush
from collections import deque,defaultdict,Counter
from bisect import bisect_left, bisect_right
from itertools import product,combinations,permutations

ipt = sys.stdin.readline

def iin():
    return int(ipt())
def lmin():
    return list(map(int,ipt().split()))

MOD = 998244353
#############################################################


for _ in range(iin()):
    N,K = input().split()
    L = len(N)
    cnt = 1
    for i in range(1,L):
        for j in range(i):
            if j >= len(K):
                break
            cnt += (int(K[j])-(j==0))*10**(i-j-1)
        if i != len(K):
            cnt += 1

    f = 0
    for j in range(L):
        if j >= len(K):
            break
        if f == 0:
            if int(N[j]) > int(K[j]):
                cnt += (int(K[j])-(j==0))*10**(L-j-1)
                f = 1
            elif int(N[j]) < int(K[j]):
                cnt += (int(N[j])-(j==0))*10**(L-j-1)
                break
            else:
                cnt += (int(K[j])-(j==0))*10**(L-j-1)
        else:
            cnt += int(K[j])*10**(L-j-1)
        
    print(cnt)
0