結果
問題 | No.888 約数の総和 |
ユーザー |
![]() |
提出日時 | 2019-09-30 12:55:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 375 bytes |
コンパイル時間 | 1,628 ms |
コンパイル使用メモリ | 170,388 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-03 05:10:35 |
合計ジャッジ時間 | 2,506 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef unsigned long long ull;typedef long long ll;int main(){ll n;cin >> n;vector<ll> v;ll sq=(ll)(sqrt(n));if(sq*sq==n) v.push_back(sq);for(ll i=1; i*i<n; i++){if(n%i==0){v.push_back(i);v.push_back(n/i);}}ll ans=0;for(int i=0; i<v.size(); i++) ans+=v[i];cout << ans << endl;return 0;}