結果

問題 No.2318 Phys Bone Maker
ユーザー otoshigo
提出日時 2023-05-26 22:57:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,072 bytes
コンパイル時間 1,164 ms
コンパイル使用メモリ 91,728 KB
最終ジャッジ日時 2025-02-13 08:13:14
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 TLE * 1
other AC * 37 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<numeric>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#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;}

const ll MOD=998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N;
    cin>>N;
    ll x=1;
    vector<ll>C;
    while(x*x<=N){
        if(N%x==0){
            C.push_back(x);
            if(x*x<N)C.push_back(N/x);
        }
        x++;
    }
    sort(all(C));
    int l=C.size();
    map<ll,int>mp;
    rep(i,l)mp[C[i]]=i;
    vector<ll>dp(l);
    dp[0]=1;
    ll ans=0;
    rep(i,l){
        rep(j,l){
            int m=mp[C[i]/gcd(C[i],C[j])*C[j]];
            if(m==i)continue;
            dp[m]+=dp[i];
            dp[m]%=MOD;
        }
    }
    cout<<dp[l-1]<<"\n";
}
0