hrbust 1577 Prince and little Princess-1
来源:互联网 发布:搜索引擎优化广告 编辑:程序博客网 时间:2024/05/22 04:55
这是第二次做栈的题,其实对于现在的自己,本应该早些把它做出来,可是一直懒惰,没有抓住学习的最好时间,才导致今天的失败,
不过其实我觉得虽然很遗憾不能去参加省赛去,但我心里还是决定要一直坚持下去,从现在慢慢的好好从基础学起,不会在放弃机会了,
because i think 坚持就是胜利~~~加油~~~
#include<iostream>#include<stdio.h>#include<string.h>using namespace std;int main(){ int stack[1024]; char str[15]; int n, i; while(cin >> n) { for(i=0; i<n; i++) { cin >> stack[i]; } int top=i-1; while(cin >> str) { if(strcmp(str, "end")==0) break; //结束 else if(strcmp(str, "pop")==0) { top--; //出栈 } else if(strcmp(str, "top")==0) { cout << stack[top]<<endl; //查询栈顶元素 } else if(strcmp(str, "empty")==0) { if(top==-1) cout << "T^T"<< endl; else cout << "^_^" << endl; //判定栈是否为空 } else if(strcmp(str, "push")==0) { top++; cin >> stack[top]; //将元素入栈 } } } return 0;}
- hrbust 1577 Prince and little Princess-1
- hrbust 1578 哈理工oj 1578 Prince and little Princess-2【双向队列】
- Prince and Princess
- 10635 - Prince and Princess
- 10635 - Prince and Princess
- UVA10635- Prince and Princess
- 10635 - Prince and Princess
- hdu4685---Prince and Princess
- UVa10635 - Prince and Princess
- uva10635 - Prince and Princess
- UVa10635 Prince and Princess
- Prince and Princess UVA
- uva 10635 Prince and Princess
- UVA 10635 Prince and Princess
- Uva-10635-Prince and Princess
- UVA 10635 Prince and Princess
- uva 10635 - Prince and Princess
- UVA 10635 Prince and Princess
- ajax请求时遇到的问题
- Java_ClassLoader_知识
- 完全用Linux工作
- hdu1533 最小费用流
- 奇偶校验位
- hrbust 1577 Prince and little Princess-1
- 行为型模式之命令模式(Command)
- 测试工具 NUnit
- The connection to adb is down, and a severe error has occured.
- VS中Resharper的Todo item自定义
- Android OTA升级过程
- Qt应用程序之Application Main Window详解
- android应用之测试利器--StrictMode(未完成,待续)
- Linux应用编程之Socket编程