poj1363
来源:互联网 发布:小米air13.3怎么样知乎 编辑:程序博客网 时间:2024/05/16 05:03
#include <iostream>#include <stdio.h>using namespace std;int main(){ int n,a[1005],z[1005],t,f,r,i; // freopen("in.txt","r",stdin); cin>>n; while (n>0) { cin>>a[1]; while (a[1]>0) { for (i=2;i<=n;i++) cin>>a[i]; f=1;r=0;
/*t=0; while (1) { if (t==n&&a[f]!=z[r]) {cout<<"No"<<endl;break;} if (t==n&&r==1&&f==n&&a[f]==z[r]) {cout<<"Yes"<<endl;break;} if (t<n) {t++;r++;z[r]=t;} if (a[f]==z[r]) {r--;f++;} }*/ for (t=1;t<=n;t++) //n个数 { r++; //入栈 z[r]=t; while (a[f]==z[r]&&f<=n&&r>=1) {f++;r--;} //相同则出栈 /*cout<<"t="<<t<<" f="<<f<<" r="<<r<<endl; for (int j=1;j<=r;j++) cout<<z[j]; cout<<endl;*/ } if (f==n+1) cout<<"Yes"<<endl;else cout<<"No"<<endl; cin>>a[1]; } cout<<endl; cin>>n; } return 0;}
给定一组进栈顺序,问栈有多少种出去的顺序
0 0
- poj1363
- poj1363
- poj1363
- Poj1363
- poj1363
- poj1363
- POJ1363
- poj1363
- POJ1363
- POJ1363
- POJ1363
- poj1363----栈
- POJ1363:Rails
- POJ1363【栈】
- 【POJ1363】栈
- poj1363——Rails
- POJ1363--Rails--栈
- POJ1363-栈应用
- front_end面试
- Android设置布局背景为白色的三种方法
- 项目中代码重构的几点思考
- Linux系统内核版本说明
- 2-6-5 友元类
- poj1363
- ios第三方支付流程
- 使用JPA连接MySQL数据库
- 浅谈NoSQL数据库
- android 各个控件及图标名称知多少
- 犯了多次的error LNK2019 错误
- 存储、中断、总线、与I/O系统_____中断系统的软、硬件功能分配
- Navicate (数据库客户端)
- Tomcat数据源配置(JNDI Datasource HOW-TO)