online_judge_1108
来源:互联网 发布:linux下关闭tomcat 编辑:程序博客网 时间:2024/05/16 18:22
#include <stdio.h>#include <stdlib.h>int main(){ int n=1,i,top; int a[10001]; char ch[10]; while(n!=0) { scanf("%d",&n); if(n<=0||n>10000) continue; top=0; for(i=0;i<n;i++) { getchar(); scanf("%s",ch); if(ch[0]=='P') scanf("%d",&a[top++]); else if(ch[0]=='O'&&top>0) top--; else if(ch[0]=='A') { if(top<=0) printf("E\n"); else printf("%d\n",a[top-1]); } } printf("\n"); } return 0;}
这代码可以正常提交!
#include <stdio.h>#include <stdlib.h>int main(){ int n=1,i,top; int a[10001]; char ch; while(n!=0) { scanf("%d",&n); if(n<=0||n>10000) continue; top=0; for(i=0;i<n;i++) { getchar(); scanf("%c",&ch); if(ch=='P') scanf("%d",&a[top++]); else if(ch=='O'&&top>0) top--; else if(ch=='A') { if(top<=0) printf("E\n"); else printf("%d\n",a[top-1]); } } printf("\n"); } return 0;}这代码提交就会出现超时!到底为什么?
0 0
- online_judge_1108
- 我的2014
- C#基础综合练习--超市收银系统的设计
- java中main方法的个数
- 码农、黑客和2B程序员之间的区别
- Unity 导出切片精灵过程浅析
- online_judge_1108
- 内存分配函数malloc 与 calloc的用法及区别
- 1072. Gas Station (30)
- android:人品计算器—第一个demo
- Objective-c自学笔记(4)-内存管理中retain和release
- Spring——HibernateTemplate、hibernateDaoTemplate
- Android 入门问题与解决(一)Please ensure that adb is correctly located at...
- 学会阅读java字节码
- 使用JDK自带的JCX生成JAVA