結果

問題 No.1206 OR, OR, OR......
ユーザー yuma220284yuma220284
提出日時 2020-08-30 13:14:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 493 bytes
コンパイル時間 2,696 ms
コンパイル使用メモリ 143,776 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-09 11:39:10
合計ジャッジ時間 2,908 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

constexpr long long MOD = 998244353;

long long Pow(long long A, long long B) {
	if (B == 0) return 1;
	if (B % 2 == 0) {
		long long C = Pow(A, B / 2);
		return (C * C) % MOD;
	}
	return (A * Pow(A, B - 1)) % MOD;
}

int main() {
	int T;
	cin >> T;
	while (T--) {
		long long N, K;
		cin >> N >> K;
		long long ANS = Pow(Pow(2, N - 1), K);
		ANS *= (Pow(2, K) + MOD - 1) % MOD;
		ANS %= MOD;
		ANS *= N;
		ANS %= MOD;
		cout << ANS << endl;
	}
}
0