結果

問題 No.2380 Sylow P-subgroup
ユーザー Nzt3
提出日時 2023-07-14 21:28:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 415 bytes
コンパイル時間 2,176 ms
コンパイル使用メモリ 191,488 KB
最終ジャッジ日時 2025-02-15 10:39:13
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int mod=998244353;
long long modpow(long long a,int 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);
  ll N,P;
  cin>>N>>P;
  int cnt=0;
  while(N>0){
    cnt+=N/P;
    N/=P;
  }
  cout<<modpow(P,cnt)<<'\n';
}
0