結果
問題 | No.278 連続する整数の和(2) |
ユーザー |
![]() |
提出日時 | 2015-09-04 23:34:18 |
言語 | C++11 (gcc 8.5.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 1,142 bytes |
コンパイル時間 | 443 ms |
使用メモリ | 3,552 KB |
最終ジャッジ日時 | 2023-01-12 15:50:14 |
合計ジャッジ時間 | 1,693 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
3,368 KB |
testcase_01 | AC | 2 ms
3,500 KB |
testcase_02 | AC | 13 ms
3,552 KB |
testcase_03 | AC | 1 ms
3,540 KB |
testcase_04 | AC | 2 ms
3,528 KB |
testcase_05 | AC | 2 ms
3,552 KB |
testcase_06 | AC | 2 ms
3,496 KB |
testcase_07 | AC | 2 ms
3,496 KB |
testcase_08 | AC | 12 ms
3,372 KB |
testcase_09 | AC | 12 ms
3,476 KB |
testcase_10 | AC | 15 ms
3,444 KB |
testcase_11 | AC | 12 ms
3,472 KB |
testcase_12 | AC | 1 ms
3,440 KB |
testcase_13 | AC | 11 ms
3,372 KB |
testcase_14 | AC | 8 ms
3,424 KB |
testcase_15 | AC | 9 ms
3,372 KB |
testcase_16 | AC | 8 ms
3,476 KB |
testcase_17 | AC | 12 ms
3,520 KB |
ソースコード
#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; }