結果
問題 | No.2576 LCM Pattern |
ユーザー |
|
提出日時 | 2023-12-06 21:40:24 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 782 bytes |
コンパイル時間 | 4,789 ms |
コンパイル使用メモリ | 309,744 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-27 01:49:09 |
合計ジャッジ時間 | 5,531 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <bits/stdc++.h>#if __has_include(<atcoder/all>)#include <atcoder/all>using namespace atcoder;#endif#define rep(i, n) for (int i = 0; i < (n); ++i)using namespace std;using P = pair<int, int>;using mint = modint998244353;vector<P> factorize(int n) {vector<P> res;for (int i = 2; i*i <= n; ++i) {if (n%i != 0) continue;res.emplace_back(i, 0);while (n%i == 0) {n /= i;res.back().second++;}}if (n != 1) res.emplace_back(n, 1);return res;}int main() {int n, m;cin >> n >> m;auto fs = factorize(m);mint ans = 1;for (auto [_, x] : fs) {ans *= mint(x+1).pow(n) - mint(x).pow(n);}cout << ans.val() << '\n';return 0;}