結果

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

ソースコード

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;

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

	cout << res << '\n';

	return 0;
}
0