結果
問題 |
No.420 mod2漸化式
|
ユーザー |
![]() |
提出日時 | 2016-10-31 14:51:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 526 bytes |
コンパイル時間 | 593 ms |
コンパイル使用メモリ | 70,660 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-25 00:03:41 |
合計ジャッジ時間 | 2,121 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | WA * 35 |
ソースコード
#include <iostream> #include <queue> #include <map> using namespace std; int main() { int cnt=0; long long ans=0; queue<pair<long long ,long long>>que; que.push(make_pair(1,1)); while(!que.empty()){ pair<long long,long long> p; p = que.front();que.pop(); if(p.second==5){ cnt++; ans+= p.first; } if(p.second<=5){ if(p.first*2<=2147483647)que.push(make_pair(p.first*2,p.second)); if(p.first*2+1<=2147483647)que.push(make_pair(p.first*2+1,p.second+1)); } } cout<<cnt<<" "<<ans<<endl; return 0; }