紫书章六例题二 Rails
来源:互联网 发布:淘宝开通购物号 编辑:程序博客网 时间:2024/05/16 05:26
对栈的使用
stack sta;
sta.push();
sta.top();
sta.pop();
#include <iostream>#include <cstring>#include <cstdio>#include <cstring>#include <algorithm>#include <stack>using namespace std;int t[1005];int main(){ // freopen("E:\\input.txt","r",stdin); int case1=0; for(;;) { if(case1) printf("\n"); case1++; int n; scanf("%d",&n); if(n==0) break; stack<int> sta; for(;;) { int a; scanf("%d",&a); if(a==0) break; else t[0]=a; for(int i=1;i<n;i++) scanf("%d",&t[i]); int temp=1,flag=0; for(int i=0;i<n;i++) { while(t[i]>=temp) {sta.push(temp);temp++;} if(!sta.empty()) { int k=sta.top(); sta.pop(); if(k!=t[i]) flag=1; } if(flag) break; } if(flag) printf("No\n"); else printf("Yes\n"); } } return 0;}
0 0
- 紫书章六例题二 Rails
- UAa514 例题6-2 铁轨 Rails
- C经典例题二
- 文件例题(二)
- 省二例题
- Rails Cookbook翻译(二)
- Rails中文Podcasts【二】
- Rails中文Podcasts【二】
- C语言程序例题(二)
- 计算机网络相关例题(二)
- 并查集例题二
- 例题6-2 UVA 514 - Rails (铁轨)
- Rails学习笔记(二)
- Rails日常总结(二)
- 信号量(三) 经典例题(二)
- 经典多态例题(二)
- c语言基础例题之二
- c++例题 构造函数(二)
- effective javascript(一)——认识javascript浮点数
- Node.js 简易服务器
- 455
- CodeForces
- (推荐使用)SpringMVC注解,基本配置
- 紫书章六例题二 Rails
- UE4捡枪开火类似
- Cas单点登录的简单了解
- HBase Quick Start
- 几种最小生成树算法
- 移动端web自适应解决方案: adaptive.js
- Unity 使用C/C++ 跨平台终极解决方案(PC,iOS,Android,以及支持C/C++的平台)
- 商人的诀窍
- 区块链开发环境搭建总结