| 记录编号 | 181506 | 评测结果 | AAAAAA | 
    
        | 题目名称 | 72.队列基本操作 | 最终得分 | 100 | 
    
        | 用户昵称 |  forever | 是否通过 | 通过 | 
    
        | 代码语言 | C++ | 运行时间 | 0.003 s | 
    
        | 提交时间 | 2015-08-25 17:47:49 | 内存使用 | 0.32 MiB | 
    
    
    
    		显示代码纯文本
		
		#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int n,tail,head=1,q[2003],f,u;
int main(){
    freopen("queue.in","r",stdin);
	freopen("queue.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d",&f);
		if(f==1)
		 {
			tail=0;head=1;
			continue;
		 }
		if(f==2)
		{
			scanf("%d",&u);
			if(tail-head+1>=10)
			 printf("queue out\n");
			else
			  q[++tail]=u;
			continue;
		}
		if(f==3)
		  {
				//cout<<head<<" "<<tail<<endl<<endl;
				if(tail-head+1==0)
				  printf("queue empty\n");
				else
			    	head++;
				continue;
		  }
		if(f==4)
		 {  
			printf("%d\n",tail-head+1);
			for(int k=head;k<=tail;++k)
				  printf("%d ",q[k]);
		 }
	}
}