結果

問題 No.278 連続する整数の和(2)
ユーザー snrnsidy
提出日時 2021-07-18 23:54:47
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 1,699 ms
コンパイル使用メモリ 193,444 KB
最終ジャッジ日時 2025-01-23 03:15:53
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	long long int N;
	long long int res = 0;

	cin >> N;

	if (N % 2 == 0)
	{
		N /= 2;
	}

	for (long long int i = 1; i <= sqrt(N); i++)
	{
		if (N % i == 0)
		{
			if (i == (N / i))
			{
				res += i;
			}
			else
			{
				res += i;
				res += (N / i);
			}
		}
	}

	cout << res << '\n';

	return 0;
}
0