結果

問題 No.2380 Sylow P-subgroup
ユーザー eve__fuyuki
提出日時 2023-10-10 16:52:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 1,500 ms
コンパイル使用メモリ 194,000 KB
最終ジャッジ日時 2025-02-17 06:39:04
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/modint>
#include <bits/stdc++.h>
using namespace std;

using mint = atcoder::modint998244353;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    long long n, p;
    cin >> n >> p;
    long long ans = 0;
    long long div = p;
    while (n >= div) {
        ans += n / div;
        div *= p;
    }
    cout << mint(p).pow(ans).val() << endl;
}
0