結果
問題 | No.2007 Arbitrary Mod (Easy) |
ユーザー |
![]() |
提出日時 | 2022-07-15 21:26:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 471 bytes |
コンパイル時間 | 1,934 ms |
コンパイル使用メモリ | 193,456 KB |
最終ジャッジ日時 | 2025-01-30 07:26:36 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int64_t a, n;cin >> a >> n;auto pow_mod = [](int64_t a, int64_t n, int64_t m) {int64_t ret = 1;for (; 0 < n; n >>= 1) {if (n & 1) {(ret *= a) %= m;}(a *= a) %= m;}return ret;};int64_t m = 998244353;cout << m << endl;cout << pow_mod(a, n, m) << endl;return 0;}