結果

問題 No.278 連続する整数の和(2)
ユーザー ふーらくたる
提出日時 2018-01-15 01:28:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 852 ms
コンパイル使用メモリ 63,104 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 03:11:23
合計ジャッジ時間 1,382 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

using int64 = long long;

int main() {
    int64 N;
    cin >> N;

    if (N % 2 == 0) N /= 2;
    int64 ans = 0;
    for (int64 n = 1; n * n <= N; n++) {
        if (N % n != 0) continue;
        int64 m = N / n;
        ans += n;
        if (n != m) ans += m;
    }
    cout << ans << endl;

    return 0;
}
0