結果

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    long long int N;

    cin >> N;

    long long int res = 0;

    for (long long int i = 1; i <= sqrt(N); i++)
    {
        if ((N % i == 0))
        {
            res += i;
            if (i * i != N)
            {
                res += (N / i);
            }
        }
    }

    cout << res << '\n';
    return 0;
}
0