結果

問題 No.2576 LCM Pattern
ユーザー ldsybldsyb
提出日時 2023-12-24 19:35:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 703 bytes
コンパイル時間 4,699 ms
コンパイル使用メモリ 267,948 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-24 19:35:36
合計ジャッジ時間 5,373 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 1 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif

int main()
{
    int64_t n, m;
    cin >> n >> m;

    using mint = modint998244353;

    map<int64_t, int64_t> mp;
    {
        int64_t x = m;
        for (int64_t i = 2; i * i <= x; i++)
        {
            while (x % i == 0)
            {
                mp[i]++;
                x /= i;
            }
        }
        if (1 < x)
        {
            mp[x]++;
        }
    }

    mint ans = 1;

    for (auto [a, e] : mp)
    {
        ans *= mint(e + 1).pow(n) - mint(e).pow(n);
    }

    cout << ans.val() << endl;

    return 0;
}
0