結果
問題 | No.278 連続する整数の和(2) |
ユーザー |
![]() |
提出日時 | 2017-05-21 11:33:45 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 488 bytes |
コンパイル時間 | 1,375 ms |
コンパイル使用メモリ | 157,660 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 09:13:44 |
合計ジャッジ時間 | 2,239 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include"bits/stdc++.h"//#include<bits/stdc++.h>using namespace std;#define print(x) cout<<x<<endl;#define rep(i,a,b) for(int i=a;i<b;i++)#define REP(i,a) for(int i=0;i<a;i++)typedef long long ll;const ll mod = 10000000000;int main() {ll n;cin >> n;ll ans = 1;if (n != 1 && n % 2 == 1)ans += n;else if(n!=2&&n%2==0) { n /= 2; ans += n; }for (ll i = 2; i*i <= n; i++) {if (n%i == 0) {ans += i;if (n / i != i)ans += n / i;}}print(ans);return 0;}