結果
問題 | No.278 連続する整数の和(2) |
ユーザー |
![]() |
提出日時 | 2015-09-05 00:17:16 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 779 bytes |
コンパイル時間 | 674 ms |
コンパイル使用メモリ | 79,084 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 09:02:29 |
合計ジャッジ時間 | 1,426 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
#include <iostream>#include <string>#include <vector>#include <cmath>#include <algorithm>#include <cstdlib>#include <ctime>#include <cstdio>#include <functional>#include <set>#include <sstream>#include <map>#include <queue>#include <stack>using namespace std;long long calc(long long x){long long res=1;for(long long i=2;i*i<=x;i++){long long tmp=i;while(x%i==0){x/=i; tmp*=i;}//(1+i^1+i^2+...+i^(n-1))=(i^n)/(i-1)//tmp=i^nres*=(tmp-1)/(i-1);}//残ったxは素数if(x!=1){res*=(1+x);}return res;}int main(){long long n;cin>>n;long long x;if(n%2) x=n;else x=n/2;cout<<calc(x)<<endl;return 0;}