結果
問題 | No.278 連続する整数の和(2) |
ユーザー |
![]() |
提出日時 | 2015-09-05 15:29:57 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 1,029 bytes |
コンパイル時間 | 689 ms |
コンパイル使用メモリ | 80,868 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 09:04:05 |
合計ジャッジ時間 | 1,509 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include <iostream>#include <algorithm>#include <string>#include <vector>#include <queue>#include <stack>#include <set>#include <map>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <numeric>#include <bitset>#include <complex>#define rep(x, to) for (int x = 0; x < (to); x++)#define REP(x, a, to) for (int x = (a); x < (to); x++)#define foreach(itr, x) for (typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++)#define EPS (1e-14)using namespace std;typedef long long ll;typedef pair<int, int> PII;typedef pair<ll, ll> PLL;typedef complex<double> Complex;typedef vector< vector<int> > Mat;ll N;ll ans = 1;void solve(ll x) {for (ll i = 2; i * i <= x; i++) {if (x % i != 0) continue;ll power = 1;while (x % i == 0) {power *= i;x /= i;}power *= i;ans *= (power - 1) / (i - 1);}// Nが素数の場合if (x != 1) {ans *= 1 + x;}cout << ans << endl;}int main() {cin >> N;solve(N % 2 == 0 ? N / 2 : N);return 0;}