66分求助~ 帮本蒟蒻者关注
查看原帖
66分求助~ 帮本蒟蒻者关注
751812
Jiaxiaoyuan11楼主2023/10/20 22:54
#include<iostream>
using namespace std;
const int N = 1e6 + 7;
int t, n;
string a[N], x;

int main(){
	int q = 0;//1 2 3 ... 
	scanf("%d", &t);
	while(t--){
		scanf("%d", &n);
		while(n--){
			cin >> x;
			if(x[0] == 'q'){
				if(q == 0)
					printf("Anguei!\n");
				else
					cout << a[q] << "\n";
			}
			if(x[0] == 's')
				printf("%d\n", q);
			if(x[0] == 'p'){
				if(x[1] == 'o'){
					if(q == 0)
						printf("Empty\n");
					else
						q--;
				}
				else
					cin >> a[++q];
			} 
		}
	}
	return 0;
}

2023/10/20 22:54
加载中...