結果
| 問題 |
No.2380 Sylow P-subgroup
|
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2023-07-14 22:39:49 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 296 bytes |
| コンパイル時間 | 247 ms |
| コンパイル使用メモリ | 82,688 KB |
| 実行使用メモリ | 52,096 KB |
| 最終ジャッジ日時 | 2024-09-16 07:43:52 |
| 合計ジャッジ時間 | 1,665 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 1 |
ソースコード
def exp(a,b,p):
ans,mul,div=1,a,1
for i in range(70):
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
ans=1
print(exp(P,ci%p,p)%p)
nikoro256