結果

問題 No.1206 OR, OR, OR......
ユーザー 夜
提出日時 2020-11-30 20:39:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,016 bytes
コンパイル時間 734 ms
コンパイル使用メモリ 91,804 KB
実行使用メモリ 4,368 KB
最終ジャッジ日時 2023-10-11 03:02:36
合計ジャッジ時間 1,927 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int t;
	cin >> t;
	for (int i = 0; i < t; i++) {
		long long n, k;
		cin >> n >> k;
		long long x = 2;
		long long y = k;
		long long ans = 1;
		while (y > 0) {
			if ((y & 1) == 1) {
				ans = ans * x % 998244353;
			}
			x = x * x % 998244353;
			y >>= 1;
		}
		ans = (ans + 998244352) % 998244353;
		x = 2;
		y = n - 1;
		long long ans1 = 1;
		while (y > 0) {
			if ((y & 1) == 1) {
				ans1 = ans1 * x % 998244353;
			}
			x = x * x % 998244353;
			y >>= 1;
		}
		x = ans1;
		y = k;
		ans1 = 1;
		while (y > 0) {
			if ((y & 1) == 1) {
				ans1 = ans1 * x % 998244353;
			}
			x = x * x % 998244353;
			y >>= 1;
		}
		ans *= ans1;
		ans %= 998244353;
		ans *= n;
		ans %= 998244353;
		cout << ans << endl;
	}
}
0