大佬救救,RE
查看原帖
大佬救救,RE
988971
hanwud楼主2023/11/18 08:39
#include<bits/stdc++.h>
using namespace std;
long long  *head,*tail,z[10001]={0};
void push(int x){
	head++;
	z[*head]=x;
}
void pop(){
    if(tail==head++)  cout<<"ERR_CANNOT_QUERY";
	else tail++;
}
void query(){
	if(tail==head++)  cout<<"ERR_CANNOT_QUERY";
    else cout<<z[*head];	
}
void size(){
	cout<<head-tail;
}
int main()
{
	int n;
	cin>>n;
	*head=z[1];*tail=z[2];
	for(int i=1;i<=n;i++){
		int a;
		cin>>a;
		if(a == 1){
			int j;
			cin>>j;
			push(j);
			continue;
		}
		if(a == 2)  pop();continue;
		if(a == 3)  query();continue;
		if(a == 4)  size();continue;
	}
	return 0;
}
2023/11/18 08:39
加载中...