Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
121459 | 吴悠 | Blah数集 | C++ | 通过 | 100 | 0 MS | 388 KB | 683 | 2024-01-21 20:11:01 |
#include<iostream> #include<queue> using namespace std; queue<int> a,b; int main(){ int m,n; while(cin>>m>>n){ while(a.empty()==false){ a.pop(); } while(b.empty()==false){ b.pop(); } a.push(m*2+1); b.push(m*3+1); for(int i=1;i<=n-2;i++){ int aa=a.front(); int bb=b.front(); if(aa<bb){ a.pop(); a.push(aa*2+1); b.push(aa*3+1); } else if(aa>bb){ b.pop(); a.push(bb*2+1); b.push(bb*3+1); } else { a.pop(); b.pop(); a.push(aa*2+1); b.push(aa*3+1); } } if(a.front()<=b.front()){ cout<<a.front()<<endl; } else cout<<b.front()<<endl; } return 0; }