Rails
2013-03-24 23:19
99 查看
http://poj.org/problem?id=1363
View Code
View Code
#include<iostream> #include<stack> using namespace std ; int main() { int a[1005] ; int n ; while(cin>>n,n!=0) { while(cin>>a[0],a[0]) { for(int i=1; i<n; i++) cin>>a[i] ; stack<int>s ; int num = 0 ; for(int i=1; i<=n; i++) { s.push(i) ; while(!s.empty()&&s.top()==a[num]) { s.pop() ; num++ ; } } if(s.empty()) cout<<"Yes"<<endl ; else cout<<"No"<<endl ; } cout<<endl ; } return 0 ; }
相关文章推荐
- Ruby on Rails 入门之:(16) Ruby中的定义操作、取消定义操作
- rails插件devise错误查找与解决
- Ruby on Rails 入门之:(24) Ruby 中数据持久化、数据库操作
- rails 风格指导--让你写出更地道的ruby/rails程序
- backbone-bootstrap-rails
- ruby rails 中对数据库的操作
- Ruby on Rails
- 创建一个Ruby on Rails应用程序
- Rails开始遇到的一个端口占用问题的解决方法
- 深度linux12.06或ubuntu12.10下 ——配置ruby on rails开发环境
- Ruby On Rails connect with MySQL
- 今天Rails都学到了啥
- ruby on rails
- rails项目怎么提高速度 (linux nginx)(brown)
- DevKit及rails的安装
- UVA 514 - Rails
- rails查询学习笔记
- memcache与rails
- RoR(Ruby on Rails)学习笔记(5)
- MVC in Ruby on Rails