結果
問題 | No.278 連続する整数の和(2) |
ユーザー |
|
提出日時 | 2016-10-25 09:32:45 |
言語 | C++11 (gcc 13.3.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 627 bytes |
コンパイル時間 | 407 ms |
コンパイル使用メモリ | 57,396 KB |
最終ジャッジ日時 | 2024-11-14 19:53:00 |
合計ジャッジ時間 | 883 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:35:8: error: ‘pow’ was not declared in this scope 35 | ll c=pow(2,b); | ^~~
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;typedef long long ll;int main(){ll N=0;cin>>N;ll a=N;ll b=0;if(N%2==0){while(1){if(a%2!=0){break;}a/=2;b+=1;}}if(a>1){vector<ll> v;for(ll i=3;i*i<=a;i+=2){if(a%i==0){v.push_back(i);v.push_back(a/i);}}sort(v.begin(),v.end());auto result=unique(v.begin(),v.end());v.erase(result,v.end());for(ll i=0;i<v.size();++i){a+=v[i];}}if(N>2) a+=1;ll c=pow(2,b);c-=1;if(c>0) a*=c;cout<<a<<endl;}