結果
問題 | No.888 約数の総和 |
ユーザー |
|
提出日時 | 2020-04-29 00:10:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 1,883 bytes |
コンパイル時間 | 2,319 ms |
コンパイル使用メモリ | 198,556 KB |
最終ジャッジ日時 | 2025-01-10 03:08:53 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include "bits/stdc++.h" // only gcc using namespace std; // std::cout, std::endl #pragma region TEMPLATE constexpr auto INF = 1000000000000; //10^12;; constexpr auto MOD = 1000000007; //10^9+7;; constexpr auto EPS = 1e-9; constexpr auto PI = 3.141592653589793238462643383279; #define endl '\n'; // std::endl => '\n' #define nl cout << endl; #define ALL(v) v.begin(), v.end() #define RALL(x) (x).rbegin(), (x).rend() #define SORT(v) sort(ALL(v)) #define RSORT(v) sort(RALL(v)) #define REVERSE(v) reverse(ALL(v)) #define SZ(x) ((int)(x).size()) #define FOR(i, j, k) for (int i=j ; i<k ; i++) #define RFOR(i, j, k) for (int i=j ; i>=k ; i--) #define REP(i, j) FOR(i, 0, j) #define RREP(i, j) RFOR(i, j, 0) #define FOREACH(it,l) for (auto it = l.begin(); it != l.end(); it++) #define YES(p) cout << (p ? "YES":"NO") << endl; #define Yes(p) cout << (p ? "Yes":"No") << endl; template<class T = int>T in(){T x; cin >> x; return x; } // read template<class T> void out(T value){ cout << value << endl; }// write template<class T> bool chmax(T& a,const T& b){ if (a < b){ a = b; return 1; } return 0; } // change max template<class T> bool chmin(T& a,const T& b){ if (b < a){ a = b; return 1; } return 0; } // change min using VI = vector<int>; using ll = long long; using VLL = vector<ll>; #pragma endregion vector<int64_t> divisor(int64_t n) { vector<int64_t> ret; for (int64_t i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); } } sort(begin(ret), end(ret)); return (ret); } signed main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(10); auto N = in<int64_t>(); vector<int64_t> vec = divisor(N); out(accumulate(ALL(vec), 0LL)); return 0; }