結果
| 問題 | No.2576 LCM Pattern | 
| コンテスト | |
| ユーザー |  eve__fuyuki | 
| 提出日時 | 2023-12-09 05:48:36 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 699 bytes | 
| コンパイル時間 | 2,419 ms | 
| コンパイル使用メモリ | 196,188 KB | 
| 最終ジャッジ日時 | 2025-02-18 09:45:53 | 
| ジャッジサーバーID (参考情報) | judge5 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using mint = atcoder::modint998244353;
void fast_io() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}
int main() {
    fast_io();
    int n, m;
    cin >> n >> m;
    vector<int> cnts;
    for (int i = 2; i * i <= m; i++) {
        if (m % i == 0) {
            int cnt = 0;
            while (m % i == 0) {
                m /= i;
                cnt++;
            }
            cnts.push_back(cnt);
        }
    }
    if (m != 1) {
        cnts.push_back(1);
    }
    mint ans = 1;
    for (int cnt : cnts) {
        ans *= mint(cnt + 1).pow(n) - mint(cnt).pow(n);
    }
    cout << ans.val() << endl;
}
            
            
            
        