結果

問題 No.1206 OR, OR, OR......
ユーザー 👑 Nachia
提出日時 2020-10-12 17:22:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 64,472 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-20 18:06:32
合計ジャッジ時間 1,190 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

const ULL M = 998244353;

ULL powm(ULL a, ULL i){
	if (i == 0) return 1;
	ULL res = powm(a * a % M, i / 2);
	if (i % 2 == 1) res = res * a % M;
	return res;
}

void loop(){
	ULL N, K; cin >> N >> K;
	ULL ans = (powm(2, K) + M - 1) % M;
	ans = ans * N % M;
	ans = ans * powm(2, K * (N - 1)) % M;
	cout << ans << endl;
}

int main(){
	int T; cin >> T;
	while (T--) loop();

	return 0;
}
0