結果
| 問題 | No.2902 ZERO!! |
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2024-10-02 14:08:25 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 2,000 ms |
| コード長 | 931 bytes |
| 記録 | |
| コンパイル時間 | 1,162 ms |
| コンパイル使用メモリ | 225,104 KB |
| 実行使用メモリ | 16,768 KB |
| 最終ジャッジ日時 | 2026-07-05 20:40:54 |
| 合計ジャッジ時間 | 4,116 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
#include <atcoder/modint>
using mint = atcoder::modint998244353;
int main() {
fast_io();
int n;
cin >> n;
vector<int> factors;
{
bool is_p[n + 1];
for (int i = 0; i <= n; i++) is_p[i] = true;
is_p[0] = is_p[1] = false;
for (int i = 2; i <= n; i++) {
if (is_p[i]) {
for (int j = i * 2; j <= n; j += i) {
is_p[j] = false;
}
int cnt = 0;
for (int j = i;; j *= i) {
cnt += n / j;
if (n / j < i) break;
}
factors.push_back(cnt);
}
}
}
map<int, int> cnt;
for (int j : factors) {
cnt[j]++;
}
int M = factors[0];
mint ans = 0;
for (int i = 1; i <= M; i++) {
mint tmp = 1;
auto it = cnt.lower_bound(i);
while (it != cnt.end()) {
tmp *= mint(it->first / i + 1).pow(it->second);
it++;
}
ans += tmp - 1;
}
cout << ans.val() << endl;
}
eve__fuyuki