結果

問題 No.278 連続する整数の和(2)
ユーザー rsk0315
提出日時 2019-01-11 03:28:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 314 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 27,520 KB
最終ジャッジ日時 2025-01-06 20:13:59
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%jd", &N);
      |     ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstdint>

int main() {
    intmax_t N;
    scanf("%jd", &N);
    intmax_t M = (N+1) / 2;
    intmax_t res = 0;
    for (intmax_t i = 1; i*i <= M; ++i) {
        if (M % i == 0) {
            res += i;
            if (i != M / i) res += M / i;
        }
    }
    printf("%jd\n", res);
}
0