結果

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

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <numeric>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <cmath>
#include <queue>
#include <set>

#define rep(i, a) REP(i, 0, a)
#define REP(i, a, b) for(int i = a; i < b; ++i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> P;
typedef std::pair<P, int> PP;
struct edge{ int to, time, cost; };
const double esp = 1e-9;

struct Node{
	int r = 0, l = 0;
	Node* parent = nullptr;
	std::vector<Node*> child;
};

ll n;
/*Node node[100001];

void down(Node &n, int k){
	n.r = k;
	int s = n.child.size();
	if (s == 0)return;
	else{
		rep(i, s)down(*n.child[i], k + 1);
	}
}

int main(){
	std::cin >> n;
	rep(i, n){
		int x, y;
		std::cin >> x >> y;
		node[x - 1].child.push_back(&node[y]);
	}
	rep(i, n){
		int s = node[i].child.size();
		if (){
			int s = node[i]
		}
	}
	return 0;
}*/

int main(){
	ll ans = 0;
	std::cin >> n;
	n = (n % 2 == 0 ? n / 2 : n);
	for (ll i = 1; i * i <= n; ++i){
		if (n % i == 0){
			ans += i;
			ans += n / i;
			if (i == n / i)ans -= n / i;
		}
	}
	std::cout << ans << std::endl;
	return 0;
}
0