結果

問題 No.278 連続する整数の和(2)
ユーザー 夜
提出日時 2020-12-02 16:17:16
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 542 bytes
コンパイル時間 706 ms
コンパイル使用メモリ 90,624 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-11 11:31:08
合計ジャッジ時間 2,010 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	long long n;
	cin >> n;
	long long ans = 0;
	for (long long i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			if (i % 2 == 1) {
				ans += i;
			}
			if ((n / i) % 2 == 1 && i != n / i) {
				ans += n / i;
			}
		}
	}
	cout << ans << endl;
}
0