結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー SSRSSSRS
提出日時 2022-07-15 21:20:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 1,603 ms
コンパイル使用メモリ 165,772 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 16:34:27
合計ジャッジ時間 4,141 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
long long modpow(long long a, long long b){
	long long ans = 1;
	while (b > 0){
		if (b % 2 == 1){
			ans *= a;
			ans %= MOD;
		}
		a *= a;
		a %= MOD;
		b /= 2;
	}
	return ans;
}
int main(){
  long long a, n;
  cin >> a >> n;
  cout << MOD << endl;
  cout << modpow(a, n) << endl;
}
0