結果
問題 | No.278 連続する整数の和(2) |
ユーザー |
![]() |
提出日時 | 2016-04-05 17:08:54 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 549 bytes |
コンパイル時間 | 448 ms |
コンパイル使用メモリ | 61,756 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-23 09:11:08 |
合計ジャッジ時間 | 1,112 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include<iostream>#include<math.h>using namespace std;unsigned long long sumofx(unsigned long long a);int main(){unsigned long long n;cin >> n;cout << sumofx(n % 2 ? n : n / 2) << endl;return 0;}unsigned long long sumofx(unsigned long long a){unsigned long long ans=1, b=1, c=0,i;while (a % 2 == 0) {c++;b = b + pow(2, c);a /= 2;}ans *= b;for (i = 3; i <= sqrt(a); i+=2) {b = 1;c = 0;while (a%i == 0) {c++;b = b + pow(i, c);a /= i;}ans *= b;}if (a != 1)ans *= a + 1;return ans;}