結果

問題 No.278 連続する整数の和(2)
ユーザー nasadigital
提出日時 2015-09-06 23:51:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 1,531 ms
コンパイル使用メモリ 157,392 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 09:05:04
合計ジャッジ時間 2,268 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;

int main()
{
    ll n;
    cin>>n;
    if(n%2==0)
        n/=2;
    ll rez=0;
    for(ll ctr1=1;ctr1*ctr1<=n;ctr1++){
        if(ctr1*ctr1==n) {rez+=ctr1;continue;}
        if(n%ctr1==0)
            rez+=ctr1+n/ctr1;
    }
    cout<<rez<<endl;
    return 0;
}
0