Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
栈之操作
Time Limit: 2000ms, Special Time Limit:5000ms, Memory Limit:32768KB
Total submit users: 48, Accepted users: 44
Problem 11528 : No special judgement
Problem description
  给定一个32位整数栈,3种操作,分别是:
push x:将x入栈;
pop:出栈;
top:取栈顶元素的值。
栈内元素总数不超过100000个,初始时栈为空。

Input
  输入有若干个案例,每个案例有若干行。每个案例的第1行是一个整数n,表示操作数量;其后n行表示操作。

Output
  每个案例首先输出序号(见样例,Case与冒号无空格,冒号与序号空一格,序号后无空格)。然后对于pop操作,如果恰好当时栈为空则输出EMPTY,否则无需输出;对于top操作,如果当时栈为空则输出EMPTY,否则输出栈顶元素的值。

Sample Input
3
pop
push 100
top
Sample Output
Case: 1
EMPTY
100
Submit   Clarifications   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:2297 today,16259024 total, since 2010-05-07