Poj 1363 Rails
2010-09-10 10:13
519 查看
#include<cstdio> #include<cstring> #include<stack> using namespace std; const int maxn=1005; stack <int> S; int x[maxn]; int main() { int n,y,i,j; bool yes; while (scanf("%d",&n)&&n){ while (scanf("%d",&x[0])&&x[0]){ for (i=1;i<n;i++) scanf("%d",&x[i]); while (!S.empty()) S.pop(); yes=1; j=1; for (i=0;yes&&i<n;i++){ while (j<=x[i]){ S.push(j); j++; } y=S.top(); S.pop(); if (x[i]!=y) yes=0; } printf("%s/n",yes?"Yes":"No"); } printf("/n"); } return 0; }
相关文章推荐
- POJ 1363 Rails 笔记
- poj 1363 Rails
- 1125 POJ#1363 Rails
- poj 1363 Rails(栈)
- OpenJudg / Poj 1363 Rails
- POJ---1363-Rails(stack)
- poj 1363(Stack ) Rails
- Rails http://poj.org/problem?id=1363
- POJ 1363 Rails
- poj 1363 Rails
- poj 1363 Rails (【栈的应用】 刘汝佳的写法 *学习)
- zoj 1259 || poj 1363 rails(栈)
- POJ_1363_Rails(栈模拟)
- 【poj】1363-Rails
- POJ 1363 Rails
- poj1363--Rails解题报告(c++版)
- poj 1363 Rails(栈)
- POJ 1363 Rails
- poj 1363 Rails 数组模拟栈操作
- poj 1363 Rails