编译top函数没过。。。求调
查看原帖
编译top函数没过。。。求调
719614
lihua_miaowu楼主2024/1/9 22:30
#include<bits/stdc++.h>
using namespace std;
int t, n, x;
string s;
int main(){
	cin >> t;
	for(int i=0; i<t; i++){
		cin >> n;
		queue<unsigned long long> q;
		for(int i=0; i<n; i++){
			cin >> s;
			if(s=="push"){
				cin >> x;
				q.push(x);
			}
			else if(s=="pop"){
				if(q.empty()) cout << "Empty";
				else q.pop();
			}
			else if(s=="query"){
				if(q.empty()) cout << "Anguei!";
				else cout << q.top();
			}
			else{
				cout << q.size();
			}
		}
	}
	return 0;
}
2024/1/9 22:30
加载中...