結果

問題 No.2455 Numbers Dictionary
ユーザー hiryuNhiryuN
提出日時 2023-09-01 22:29:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 87,308 KB
実行使用メモリ 77,836 KB
最終ジャッジ日時 2023-09-01 22:29:37
合計ジャッジ時間 4,868 ms
ジャッジサーバーID
(参考情報)
judge16 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,432 KB
testcase_01 AC 70 ms
71,284 KB
testcase_02 AC 124 ms
77,156 KB
testcase_03 AC 130 ms
77,692 KB
testcase_04 AC 130 ms
77,580 KB
testcase_05 AC 125 ms
77,520 KB
testcase_06 AC 131 ms
77,736 KB
testcase_07 AC 131 ms
77,560 KB
testcase_08 AC 132 ms
77,596 KB
testcase_09 AC 138 ms
77,672 KB
testcase_10 AC 130 ms
77,516 KB
testcase_11 AC 129 ms
77,520 KB
testcase_12 AC 133 ms
77,640 KB
testcase_13 AC 132 ms
77,676 KB
testcase_14 AC 131 ms
77,836 KB
testcase_15 AC 140 ms
77,412 KB
testcase_16 AC 136 ms
77,492 KB
testcase_17 AC 133 ms
77,696 KB
testcase_18 AC 129 ms
77,488 KB
testcase_19 AC 133 ms
77,588 KB
testcase_20 AC 135 ms
77,732 KB
testcase_21 AC 128 ms
77,672 KB
testcase_22 AC 132 ms
77,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t=int(input())
for i in range(t):
    ans=0
    a,b=map(int,input().split())
    n=len(str(b))
    for j in range(1,19-n):
        up=max(min(b*10**j,a+1),10**(n+j-1))
        dw=10**(n+j-1)
        #print(up,dw,up-dw)
        ans+=up-dw
    for j in range(n):
        up=max(min(b//(10**j),a),10**(n-j-1))
        dw=10**(n-j-1)
        #print(up,dw,up-dw)
        ans+=up-dw+1
    print(ans)
0