結果
| 問題 |
No.1973 Divisor Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-11 00:55:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 808 ms / 2,000 ms |
| コード長 | 1,350 bytes |
| コンパイル時間 | 1,752 ms |
| コンパイル使用メモリ | 201,012 KB |
| 最終ジャッジ日時 | 2025-01-29 20:30:49 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std ;
#define fast_input_output ios::sync_with_stdio(false); cin.tie(nullptr);
typedef long long ll ;
typedef long double ld ;
typedef pair<ll,ll> P ;
typedef tuple<ll,ll,ll> TP ;
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
#define bit_count(x) __builtin_popcountll(x)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / gcd(a,b) * b
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)
#define endl "\n"
const int mod = 1000000007 ;
ll n , m ;
int main(){
// fast_input_output
cin >> n >> m ;
vector<P> vec ;
for(ll i = 2 ; i * i <= m ; i++){
if(m % i != 0) continue;
int ex = 0 ;
while(m % i == 0){
ex++ ;
m /= i ;
}
vec.push_back(P(i,ex)) ;
}
if(m != 1) vec.push_back(P(m,1)) ;
int a = vec.size() ;
ll res = 1 ;
rep(p,a){
auto[val,ex] = vec[p];
vector<vector<ll>> dp(n,vector<ll>(ex+1,0)) ;
rep(i,ex+1) dp[0][i] = 1 ;
rep(i,n-1) rep(j,ex+1){
rep(k,ex+1){
if(j + k > ex) break;
(dp[i+1][k] += dp[i][j]) %= mod ;
}
}
ll sum = 0 ;
rep(i,ex+1) (sum += dp[n-1][i]) %= mod ;
(res *= sum) %= mod ;
}
cout << res << endl ;
}