結果

問題 No.278 連続する整数の和(2)
ユーザー tottoripaper
提出日時 2015-09-28 22:09:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 468 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 53,340 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 11:24:42
合計ジャッジ時間 1,339 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%lld", &N);
      |     ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <iostream>

typedef long long ll;

int main(){
    ll N, _N;
    scanf("%lld", &N);
    _N = N;
    
    ll res = 1ll;
    
    for(ll i=2;i*i<=N;i++){
        ll productSum = 1ll, product = 1ll;
        while(N % i == 0){
            product *= i;
            productSum += product;
            N /= i;
        }

        res *= productSum;
    }

    if(N > 1){res *= 1 + N;}
    
    if(_N % 2 == 0){
        res -= _N;
    }

    printf("%lld\n", res);
}
0