結果

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

ソースコード

diff #

#include <iostream>
#include<cstdlib>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
	long long n; cin >> n;
	if (!(n % 2))n /= 2;

	long long ans = 1;
	vector <long long> x;
	for (long long i = 2; i*i <= n; i++){
		if (!(n%i)){
			long long sum = 1;
			long long a = 1;
			while (!(n%i)){
				n /= i;
				a *= i;
				sum += a;
			}
			ans *= sum;
		}
	}
	if(n!=1)ans *= (n + 1);

	cout << ans << endl;

	return 0;
}
0