結果

問題 No.1206 OR, OR, OR......
ユーザー brthyyjp
提出日時 2020-08-30 14:26:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 82,188 KB
実行使用メモリ 60,288 KB
最終ジャッジ日時 2024-11-15 07:38:18
合計ジャッジ時間 1,258 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

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