結果
問題 |
No.2380 Sylow P-subgroup
|
ユーザー |
![]() |
提出日時 | 2023-07-14 22:42:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 300 bytes |
コンパイル時間 | 393 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 52,352 KB |
最終ジャッジ日時 | 2024-09-16 07:46:30 |
合計ジャッジ時間 | 2,025 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
def exp(a,b,p): ans,mul,div=1,a,1 for i in range(1000): if b//div%2==1: ans*=mul ans%=p mul=mul**2%p div*=2 return ans%p N,P=map(int,input().split()) ci=0 p=998244353 while N!=0: N//=P ci+=N ci%=(p-1) ans=1 print(exp(P,ci,p)%p)