結果

問題 No.1973 Divisor Sequence
ユーザー nok0
提出日時 2021-08-21 12:24:06
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 296 ms / 2,000 ms
コード長 957 bytes
コンパイル時間 2,634 ms
コンパイル使用メモリ 199,672 KB
最終ジャッジ日時 2025-01-24 01:20:44
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using mint = atcoder::modint1000000007;
#define rep(i, x) for(int i = 0; i < (x); i++)
using ll = long long;
mint res = 1;
int main() {
int n;
ll m;
cin >> n >> m;
int lim = sqrt(m);
for(int i = 2; i <= lim; i++) {
int c = 0;
while(m % i == 0) m /= i, c++;
if(c) {
vector dp(n + 1, vector(c + 1, mint(0)));
dp[0][0] = 1;
for(int i = 0; i < n; i++) {
mint cum = 0;
for(int j = c; j >= 0; j--) {
cum += dp[i][c - j];
dp[i + 1][j] = cum;
}
}
res *= accumulate(dp.back().begin(), dp.back().end(), mint(0));
}
}
if(m > 1) {
int c = 1;
vector dp(n + 1, vector(c + 1, mint(0)));
dp[0][0] = 1;
for(int i = 0; i < n; i++) {
mint cum = 0;
for(int j = c; j >= 0; j--) {
cum += dp[i][c - j];
dp[i + 1][j] = cum;
}
}
res *= accumulate(dp.back().begin(), dp.back().end(), mint(0));
}
cout << res.val() << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0