結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー Nzt3
提出日時 2022-07-15 22:22:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 2,570 ms
コンパイル使用メモリ 193,200 KB
最終ジャッジ日時 2025-01-30 08:09:09
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
long long modpow(int a,long long n){
  long long ret=1,t=a;
  for(int i=0;i<30;i++){
    if(n>>i&1)ret=ret*t%mod;
    t=t*t%mod;
  }
  return ret;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long A,N;
  cin>>A>>N;
  cout<<mod<<'\n'<<modpow(A,N%(mod-1))<<'\n';

}
0