結果

問題 No.2699 Simple Math (Returned)
ユーザー anonymouslyanonymously
提出日時 2024-03-29 21:52:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 276 bytes
コンパイル時間 492 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-03-29 21:52:47
合計ジャッジ時間 24,990 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,984 KB
testcase_01 AC 1,372 ms
9,984 KB
testcase_02 TLE -
testcase_03 AC 1,342 ms
9,984 KB
testcase_04 TLE -
testcase_05 AC 1,898 ms
9,984 KB
testcase_06 AC 1,668 ms
9,984 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#N=qM+rとすると、10^N-1を10^M+1で割った余りは(-1)^q*10^r-1
MOD=998244353
T=int(input())
for i in range(T):
    N,M=map(int,input().split())
    q=N//M
    r=N%M
    a=[1,-1][q%2]*pow(10,r,MOD)-1
    if q%2:
        a=pow(10,M,MOD)-pow(10,r,MOD)
    print(a % MOD)
0