結果

問題 No.1206 OR, OR, OR......
ユーザー brthyyjpbrthyyjp
提出日時 2020-08-30 14:26:34
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 75,472 KB
最終ジャッジ日時 2023-08-09 12:26:34
合計ジャッジ時間 1,806 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,028 KB
testcase_01 AC 79 ms
75,284 KB
testcase_02 AC 80 ms
75,140 KB
testcase_03 AC 79 ms
75,316 KB
testcase_04 AC 77 ms
74,940 KB
testcase_05 AC 78 ms
75,432 KB
testcase_06 AC 77 ms
75,472 KB
testcase_07 AC 74 ms
75,156 KB
testcase_08 AC 76 ms
75,148 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