995
查看原帖
995
1011137
封禁用户楼主2023/9/2 10:51
#include<bits/stdc++.h>
using namespace std;

long long s[1000001];
int T, top;

int main() {
	scanf("%d", &T);
	for (int i = 1; i <= T; i++) {
		int n;
		scanf("%d", &n);
		for (int j = 1; j <= n; j++) {
			char a[10];
			scanf("%s", a + 1);
			if (a[2] == 'u') {
				long long x;
				scanf("%lld", &x);
				s[++top] = x;
			}else
				if (a[1] == 'p') {
					if (top)
						--top;
					else
						printf("Empty\n");
				}else
					if (a[1] == 'q') {
						if (top)
							printf("%d\n", s[top]);
						else
							printf("Anguei!\n");
					}else
						printf("%d\n", top);
		}
	}
}
2023/9/2 10:51
加载中...