結果

問題 No.2380 Sylow P-subgroup
ユーザー nikoro256nikoro256
提出日時 2023-07-14 22:42:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 71,360 KB
最終ジャッジ日時 2023-10-14 12:59:14
合計ジャッジ時間 2,779 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,196 KB
testcase_01 AC 78 ms
71,088 KB
testcase_02 AC 76 ms
71,144 KB
testcase_03 AC 76 ms
71,068 KB
testcase_04 AC 75 ms
70,912 KB
testcase_05 AC 76 ms
71,284 KB
testcase_06 AC 76 ms
71,164 KB
testcase_07 AC 76 ms
71,240 KB
testcase_08 AC 76 ms
71,280 KB
testcase_09 AC 76 ms
71,072 KB
testcase_10 AC 77 ms
70,936 KB
testcase_11 AC 78 ms
71,360 KB
testcase_12 AC 76 ms
71,252 KB
testcase_13 AC 74 ms
71,016 KB
testcase_14 AC 76 ms
70,936 KB
testcase_15 AC 75 ms
70,936 KB
testcase_16 AC 80 ms
71,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0