結果
問題 |
No.2902 ZERO!!
|
ユーザー |
|
提出日時 | 2024-09-28 01:31:28 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 981 bytes |
コンパイル時間 | 5,588 ms |
コンパイル使用メモリ | 309,644 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-28 01:31:36 |
合計ジャッジ時間 | 7,397 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using mint = atcoder::static_modint<998244353>; //using mint = atcoder::static_modint<1000000007>; using namespace std; using namespace atcoder; using ld = long double; using ll = long long; #define mp(a,b) make_pair(a,b) #define rep(i,s,n) for(int i=s; i<n; i++) const vector<int> dx{1,0,-1,0},dy{0,1,0,-1}; int main(){ int n; cin >> n; vector<int> a; vector<bool> isprime(n+1,true); rep(i,2,n+1)if(isprime[i]){ for(int j=i*2; j<=n; j+=i)isprime[j]=false; int k=n,score=0; while(k>1){ score+=k/i; k/=i; } a.push_back(score); } //for(auto x:a)cout << x << "\n"; mint ans=0; int k=1; while(a.size()){ mint score=1; int m=a.size(); for(int i=m-1; i>=0; i--){ if(a[i]<k)a.pop_back(); else score*=(1+a[i]/k); } ans+=score-1; k++; } cout << ans.val(); }