TJU 1036 模拟栈
来源:互联网 发布:剑三成女女神捏脸数据 编辑:程序博客网 时间:2024/05/18 03:48
#include"stdio.h"#include"iostream"#include"stack"using namespace std;int main(){ //freopen("a.txt","r",stdin); int n,pos,a[1010]; while(cin>>n,n) { while(cin>>a[1],a[1]) { for(int i=2;i<=n;i++) cin>>a[i]; int pos=1; stack<int>S; for(int i=1;i<=n;i++) { S.push(i); while(!S.empty()&&S.top()==a[pos]) { pos++; S.pop(); } } if(pos==n+1) cout<<"Yes"<<endl; else cout<<"No"<<endl; } cout<<endl; } return 0;}
0 0
- TJU 1036 模拟栈
- TJU-3860 Basex(模拟)
- TJU-3979. Cards(模拟)
- TJU 3474
- TJU Sequence
- TJU Vacation
- TJU Change
- TJU Antimonotonicity
- TJU Price
- TJU 4087
- tju解题报告
- TJU Count the factors
- TJU Happy 2004
- TJU Super Square
- TJU Counting Letters
- TJU Bitwise Reverse
- 【DP】 TJU 4087
- 【TJU】4087 box DP
- RecyclerView详解之基础使用
- 关于meteor的几个槽点
- 操作系统基础
- git和github使用整理
- Linux开机自动获取IP
- TJU 1036 模拟栈
- 【LeetCode】1. Two Sum
- ubuntu “下列的软件包有不能满足的依赖关系” 问题
- UVA 10723 Cyborg Genes
- UVA 242 Stamps and Envelope Size
- Spring基础(一):对Spring一无所知的童鞋请进!!!
- bzoj1222(dp)
- some function about Date
- 栈的实现