結果

問題 No.1206 OR, OR, OR......
ユーザー brthyyjpbrthyyjp
提出日時 2020-08-30 14:26:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 61,564 KB
最終ジャッジ日時 2024-04-27 07:30:36
合計ジャッジ時間 1,421 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
52,432 KB
testcase_01 AC 57 ms
60,856 KB
testcase_02 AC 58 ms
61,356 KB
testcase_03 AC 58 ms
60,908 KB
testcase_04 AC 51 ms
61,564 KB
testcase_05 AC 54 ms
60,172 KB
testcase_06 AC 49 ms
61,184 KB
testcase_07 AC 49 ms
59,788 KB
testcase_08 AC 47 ms
61,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
mod = 998244353

def power(a, n, mod):
    bi=str(format(n,"b"))
    res=1
    for i in range(len(bi)):
        res=(res*res) %mod
        if bi[i]=="1":
            res=(res*a) %mod
    return res

for i in range(t):
    n,k = map(int, input().split())
    ans = power(power(2, n, mod), k, mod)-power(power(2, n-1, mod), k, mod)
    ans *= n
    ans %= mod
    print(ans)
0