結果

問題 No.278 連続する整数の和(2)
ユーザー ooaiu
提出日時 2025-10-07 17:18:02
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 3,460 ms
コンパイル使用メモリ 275,540 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-07 17:18:09
合計ジャッジ時間 4,517 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll N;
    cin >> N;
    if(N%2==0)N/=2;
    ll ans=0;
    for(ll d=1;d*d<=N;d++) {
        if(N%d==0) {
            ans+=d;
            if(d*d<N)ans+=N/d;
        }
    }
    cout<<ans<<"\n";
}
0