結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 WA -
testcase_02 AC 346 ms
96,588 KB
testcase_03 AC 214 ms
96,588 KB
testcase_04 AC 459 ms
96,588 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 405 ms
96,972 KB
testcase_08 AC 414 ms
96,588 KB
testcase_09 AC 426 ms
96,972 KB
testcase_10 AC 417 ms
96,972 KB
testcase_11 AC 429 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)-2)%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