結果

問題 No.278 連続する整数の和(2)
ユーザー かにかに
提出日時 2015-11-28 23:55:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 906 bytes
コンパイル時間 1,174 ms
コンパイル使用メモリ 146,528 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 05:34:02
合計ジャッジ時間 6,498 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0;i < n;i++)
#define P(p) cout<<(p)<<endl;
using namespace std;
typedef long long ll;
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };

int sttoi(std::string str) {
	int ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

ll gcd(ll a, ll b){
	if (b > a)swap(a, b); if (b == 0)return a; else{ return gcd(b, a%b); }
}
int p[1500000];
void prime(ll n){
	for (ll i = 2; i*i <= n; i++){
		while (n%i == 0){
			p[i]++;
			n /= i;
		}
	}
	if (n != 1){
		p[n]++;
	}
}

bool isPrime(ll n){
	if (n == 2) return true;
	for (ll i = 3; i*i <= n; i += 2){
		if (n % i == 0) return false;
	}
	return true;
}
void solve() {
	ll n;
	cin >> n;
	ll X = n % 2 != 0 ? n : (n / 2);
	ll sum = 0;
	for (int i = 1; i*i <= X; i++){
		if (X%i == 0){
			sum += i + X / i;
		}
	}
	P(sum);
}

int main() {
	solve();
	return 0;
}
0