結果
問題 |
No.1206 OR, OR, OR......
|
ユーザー |
|
提出日時 | 2020-11-30 20:39:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,016 bytes |
コンパイル時間 | 784 ms |
コンパイル使用メモリ | 94,188 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 02:33:55 |
合計ジャッジ時間 | 1,538 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 |
ソースコード
#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; } }