結果
| 問題 |
No.2380 Sylow P-subgroup
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-14 21:28:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 413 bytes |
| コンパイル時間 | 1,853 ms |
| コンパイル使用メモリ | 192,972 KB |
| 最終ジャッジ日時 | 2025-02-15 10:39:35 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int mod=998244353;
long long modpow(long long a,ll n){
long long ret=1,t=a;
for(int i=0;i<50;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;
ll cnt=0;
while(N>0){
cnt+=N/P;
N/=P;
}
cout<<modpow(P,cnt)<<'\n';
}