結果

問題 No.888 約数の総和
ユーザー oooooba
提出日時 2021-05-04 14:36:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 582 bytes
コンパイル時間 1,079 ms
コンパイル使用メモリ 112,572 KB
最終ジャッジ日時 2025-01-21 06:41:19
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int64_t n;
    cin >> n;
    int64_t ans = 0;
    for (auto i = int64_t(1); i * i <= n; ++i) {
        if (n % i != 0)
            continue;
        ans += i;
        ans += n / i;
        if (i * i == n)
            ans -= i;
    }
    cout << ans << endl;
    return 0;
}
0