結果
問題 |
No.888 約数の総和
|
ユーザー |
![]() |
提出日時 | 2020-07-03 07:53:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 461 bytes |
コンパイル時間 | 1,687 ms |
コンパイル使用メモリ | 172,288 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 16:17:06 |
合計ジャッジ時間 | 2,767 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; #define rep2(i, a, n) for(int i = (a); i < (n); i++) #define rep(i, n) rep2(i,0,n) int main(){ cin.tie(nullptr);ios_base::sync_with_stdio(false); ll n,a=2;cin>>n; vector<ll> ret; for(int64_t a=1;a*a<=n;a++){ if(n%a==0){ ret.push_back(a); if(a*a!=n) ret.push_back(n/a); } } sort(ret.begin(),ret.end()); ll cnt=0; for(auto&& e:ret) cnt+=e; cout<<cnt<<endl; }