http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1184&&Elaine's Queue
来源:互联网 发布:vue.js 2.0视频 编辑:程序博客网 时间:2024/06/07 13:16
一道模拟题~~可以用STL的双向队列来解决~~~
#include<iostream>#include<deque>#include<algorithm>#include<cstdio>using namespace std;int main(){int T;scanf("%d",&T);while(T--){deque<int>Q;int n,m;scanf("%d%d",&n,&m);for(int i=1;i<=n;++i) Q.push_back(i);deque<int>::iterator iter;char ch[5];for(int i=0;i!=m;++i){scanf("%s",ch);if(ch[0]=='T'){int a;scanf("%d",&a);for(iter=Q.begin();iter!=Q.end();++iter)if(*iter==a) {Q.erase(iter);Q.push_front(a);break;}}else if(ch[0]=='N'){int a=*(Q.begin());printf("%d\n",a);Q.pop_front();Q.push_back(a);}}}return 0;}
- http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1184&&Elaine's Queue
- http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1001&&纸牌游戏
- http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1003&&矩阵链乘
- http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1187&&Hole Breaker
- http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1186
- http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1182&&Counter-Strike
- http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1181
- http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1180
- http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1198&& I can do it!
- Enumerate the Triangles&&http://cdn.ac.nbutoj.com/Contest/view/id/14/problem/E.xhtml
- NOJ [1184] Elaine's Queue
- http://acm.nbut.cn:8081/Problem/view.xhtml?id=1317&&线段树单点查询
- NBOJ 1184 Elaine's Queue deque的运用
- Anger Begins&&http://acm.nbut.cn:8081/Contest/view/id/29/problem/A.xhtml
- C函数传递结构体指针 题目地址:http://ac.jobdu.com/problem.php?id=1061
- http://ac.jobdu.com/problem.php?pid=1008
- http://ac.jobdu.com/problem.php?pid=1009
- http://ac.jobdu.com/problem.php?pid=1007
- Ubuntu中修改hostname
- 每一个段都有一个block用于管理,其他block用于存放数据
- DB2 SQL Error: SQLCODE=-964, SQLSTATE=57011的原因及解决方法
- UISearchBar背景透明,去掉背景,自定义背景
- [CToolTipCtrl]悬停工具提示条信息
- http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1184&&Elaine's Queue
- 内存泄露,缓冲区溢出,堆破坏 的问题
- 《Hadoop The Definitive Guide》ch07 MapReduce Types and Formats
- 大话EM算法
- vs2010下编译Boost 1.46
- hdu 1757
- iphone 3 开发基础教程 4.6按钮编译错误
- Hibernate错误
- hdu 1003 max sum #最大字段和