66pts求条
查看原帖
66pts求条
1229237
qiuyongqin楼主2024/10/24 20:55
#include<bits/stdc++.h>
using namespace std;

int main()
{
	std::ios::sync_with_stdio( false );
	std::cin.tie( 0 ), std::cout.tie( 0 );
	unsigned long long t, n;
	std::cin >> t;
	for( int i = 1; i <= t; i++ )
	{
		std::cin >> n;
		for( int j = 1; j <= n; j++ )
		{
			
			string str;
			std::cin >> str;
			std::stack<unsigned long long> s;
			if( str[0] == 'p' && str[1] == 'u' )
			{
				unsigned long long x;
				std::cin >> x;
				s.push( x );
			}
			else if( str[0] == 'p' && str[1] == 'o' )
			{
				if( s.empty() ) std::cout << "Empty\n";
				else s.pop(); 
			}
			else if( str[0] == 'q' )
			{
				if( s.empty() ) std::cout << "Anguei!\n";
				else std::cout << s.top() << "\n";
			}
			else
			{
				std::cout << s.size() << "\n";
			}
		}
	}
	return 0; 
}
2024/10/24 20:55
加载中...