結果
| 問題 | No.2576 LCM Pattern | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-12-08 01:23:11 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 816 bytes | 
| コンパイル時間 | 680 ms | 
| コンパイル使用メモリ | 75,656 KB | 
| 最終ジャッジ日時 | 2025-02-18 09:18:06 | 
| ジャッジサーバーID (参考情報) | judge4 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
#include<atcoder/modint>
using namespace std;
using namespace atcoder;
using ll=long long;
using mint=modint998244353;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N,M;
    cin>>N>>M;
    mint ans=1;
    for(ll x=2;x*x<=M;x++){
        int e=0;
        while(M>0&&M%x==0){
            M/=x;
            e++;
        }
        if(e>0){
            ans*=mint(e+1).pow(N)-mint(e).pow(N);
        }
    }
    if(M>1){
        ans*=mint(2).pow(N)-1;
    }
    cout<<ans.val()<<"\n";
}
            
            
            
        