結果
| 問題 | No.1206 OR, OR, OR...... | 
| コンテスト | |
| ユーザー |  startcpp | 
| 提出日時 | 2020-08-30 17:18:37 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 543 bytes | 
| コンパイル時間 | 750 ms | 
| コンパイル使用メモリ | 66,516 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-15 13:23:55 | 
| 合計ジャッジ時間 | 1,265 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 8 | 
ソースコード
#include <iostream>
#define int long long
using namespace std;
int powmod(int a, int n, int mod) {
	if (n == 0) return 1;
	if (n % 2 == 0) return powmod((a * a) % mod, n / 2, mod);
	return (a * powmod(a, n - 1, mod)) % mod;
}
int mod = 998244353;
signed main() {
	int t; cin >> t;
	while (t--) {
		int n, k;
		cin >> n >> k;
		
		//n (2^(nk) - 2^((n-1)k))
		int res1 = powmod(2, n * k, mod);
		int res2 = powmod(2, (n - 1) * k, mod);
		int res3 = (res1 - res2 + mod) % mod;
		int ans = n * res3 % mod;
		cout << ans << endl;
	}
	return 0;
}
            
            
            
        