結果

問題 No.1206 OR, OR, OR......
ユーザー pockyny
提出日時 2020-08-30 16:21:14
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 722 ms
コンパイル使用メモリ 66,556 KB
最終ジャッジ日時 2025-01-13 23:50:07
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
typedef long long ll;
ll mod = 998244353;
ll pw(ll a,ll x){
    ll ret = 1;
    while(x){
        if(x&1) (ret *= a) %= mod;
        (a *= a) %= mod; x /= 2;
    }
    return ret;
}

int main(){
    int t; cin >> t;
    while(t){
        t--;
        ll n,k; cin >> n >> k;
        cout << n*((pw(2,n*k) - pw(2,k*(n - 1)) + mod)%mod)%mod << endl;
    }
}
0