結果

問題 No.278 連続する整数の和(2)
ユーザー koyoprokoyopro
提出日時 2015-10-10 12:38:40
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 717 bytes
コンパイル時間 1,219 ms
コンパイル使用メモリ 151,516 KB
実行使用メモリ 7,780 KB
最終ジャッジ日時 2023-09-27 10:48:08
合計ジャッジ時間 4,744 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

#define int long long
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
int gcd(int a, int b) { if (!b) return a; return gcd(b, a%b); }

int N,T;
signed main()
{
    cin >> N;
    int g;
    map<int, int> I;
    if (N % 2) {
        g = N;
    } else {
        g = N/2;
    }
    FOR(k,2,1e9) {
        while(g % k == 0) {
            g /= k;
            I[k]++;
        }
        if (g == 1) break;
    }
    if (g > 1) I[g]++;
    int ans = 1;
    for (auto&& kv : I) {
        int s = 1;
        REP(i,kv.second) {
            s += kv.first * (i + 1);
        }
        ans *= s;
    }
    cout << ans << endl;

    return 0;
}
0