結果
問題 |
No.2940 Sigma Sigma Div Floor Problem
|
ユーザー |
![]() |
提出日時 | 2024-08-17 20:24:08 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 558 bytes |
コンパイル時間 | 3,895 ms |
コンパイル使用メモリ | 278,556 KB |
実行使用メモリ | 22,056 KB |
最終ジャッジ日時 | 2024-10-18 20:50:09 |
合計ジャッジ時間 | 8,025 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 14 WA * 15 RE * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; int main(){ int N;ll ans=0;cin>>N; vector<pair<int,int>> yak(N+1); for(int i=1;i<=N;i++)yak[i]={i,1}; for(int i=2;i<=N;i++){ if(yak[i].first==1)continue; for(int j=i;j<=N;j+=i){ int mae=yak[j].second; while(yak[j].first%i==0){ yak[j].second+=mae; yak[j].first/=i; } } } vector<ll> rui(N+1); for(int i=1;i<=N;i++)rui[i]=yak[i].second; for(int i=1;i<=N;i++)rui[i]+=rui[i-1]; for(int i=1;i<=N;i++)ans+=rui[i]; cout<<ans<<endl; }