結果

問題 No.2380 Sylow P-subgroup
ユーザー LyricalMaestro
提出日時 2024-08-09 23:44:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 321 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 82,268 KB
実行使用メモリ 64,808 KB
最終ジャッジ日時 2024-08-09 23:44:33
合計ジャッジ時間 4,860 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 TLE * 1 -- * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

## https://yukicoder.me/problems/no/2380

MOD = 998244353

def main():
    N, P = map(int, input().split())

    ans = 0
    p = P
    while p <= N:
        x = p
        while x <= N:
            ans += 1
            x += p
        p *= P
    
    print(pow(P, ans, MOD))











if __name__ == '__main__':
    main()
0