結果

問題 No.278 連続する整数の和(2)
ユーザー face4
提出日時 2018-09-26 12:31:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 659 ms
コンパイル使用メモリ 63,232 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-10 02:37:11
合計ジャッジ時間 1,584 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

typedef long long ll;

int main(){
    ll n;
    cin >> n;

    if(n % 2 == 0)  n /= 2;

    ll ans = 0;
    for(ll i = 1; i*i <= n; i++){
        if(n % i != 0)  continue;
        ans += i + n/i;
        if(i == n/i)    ans -= i;
    }

    cout << ans << endl;
    
    return 0;
}
0