結果

問題 No.888 約数の総和
ユーザー Konton7
提出日時 2020-01-17 15:15:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 476 bytes
コンパイル時間 2,361 ms
コンパイル使用メモリ 192,124 KB
最終ジャッジ日時 2025-01-08 18:11:55
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

// #define DEBUG

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    ll n, s;
    cin >> n;
    s = 0;
    for (int i = 1; i < sqrt(n+1); i++){
        if (n % i == 0){
            s += i;
            if (i != n / i)
                s += n / i;
        }
    }
    cout << s << endl;

    return 0;
}
0