結果

問題 No.2699 Simple Math (Returned)
ユーザー miya145592miya145592
提出日時 2024-03-30 01:35:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 431 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 96,972 KB
最終ジャッジ日時 2024-03-30 01:35:24
合計ジャッジ時間 5,811 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 171 ms
96,588 KB
testcase_02 AC 350 ms
96,588 KB
testcase_03 AC 158 ms
96,588 KB
testcase_04 AC 431 ms
96,588 KB
testcase_05 AC 302 ms
96,844 KB
testcase_06 AC 250 ms
96,588 KB
testcase_07 AC 380 ms
96,972 KB
testcase_08 AC 383 ms
96,588 KB
testcase_09 AC 383 ms
96,972 KB
testcase_10 AC 390 ms
96,972 KB
testcase_11 AC 410 ms
96,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.set_int_max_str_digits(0)
input = sys.stdin.readline
MOD = 998244353
T = int(input())
NM = [list(map(int, input().split())) for _ in range(T)]
for n, m in NM:
    cnt = n//m
    amari = n%m
    if amari==0:
        if cnt%2==0:
            ans = 0
        else:
            ans = (pow(10, m, MOD)-1)%MOD
    else:
        if cnt%2==0:
            ans = (pow(10, amari, MOD)-1)%MOD
        else:
            ans = (pow(10, m, MOD)-pow(10, amari, MOD))%MOD
    print(ans)
0