Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
121457 | 吴悠 | Blah数集 | C++ | 输出超限 | 0 | 26 MS | 384 KB | 693 | 2024-01-21 20:09:34 |
#include<iostream> #include<queue> using namespace std; queue<int> a,b; int main(){ while(true){ while(a.empty()==false){ a.pop(); } while(b.empty()==false){ b.pop(); } int m,n; cin>>m>>n; 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; }