結果
問題 |
No.2902 ZERO!!
|
ユーザー |
|
提出日時 | 2024-10-12 00:35:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 633 bytes |
コンパイル時間 | 3,951 ms |
コンパイル使用メモリ | 253,084 KB |
最終ジャッジ日時 | 2025-02-24 17:23:54 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using mint = atcoder::modint998244353; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<bool> tb(n + 1); vector<mint> dp(n + 1, 1); for(int i = 2; i <= n; i++){ if(tb[i]) continue; int d = 1, cnt = 0; while((long long)d * i <= n){ d *= i; cnt += n / d; } for(int j = 1; j <= cnt; j++) dp[j] *= cnt / j + 1; for(int j = 2 * i; j <= n; j += i) tb[j] = true; } cout << accumulate(dp.begin(), dp.end(), mint(-n-1)).val() << '\n'; }