用了ull,也清空了栈,为什么还是只有33分?
查看原帖
用了ull,也清空了栈,为什么还是只有33分?
1279073
nowornever0625楼主2024/10/6 10:12
#include <bits/stdc++.h>
using namespace std;

unsigned long long t, n, x;
string s;
stack<int>st;

int main() {
	//freopen("tmp.in", "r", stdin);
	cin >> t;
	while (t--) {
		cin >> n;
		while (n--) {
			cin >> s;
			if (s[2] == 's') {
				cin >> x;
				st.push(x);
			}
			if (s[1] == 'o') {
				if (st.empty())
					cout << "Empty" << endl;
				else
					st.pop();
			}
			if (s[0] == 'q') {
				if (st.empty())
					cout << "Anguei!" << endl;
				else
					cout << st.top() << endl;
			}
			if (s[0] == 's')
				cout << st.size() << endl;
		}
		while (!st.empty()) {
			st.pop();
		}
	}
	return 0;
}
2024/10/6 10:12
加载中...