TLE
查看原帖
TLE
430901
蓝色翱翔4013楼主2023/7/1 00:06

求大佬看看

#include<bits/stdc++.h>
using namespace std;
int main()
{
	stack<int>s;
	string a;
	while(1)
	{
		cin>>a;
		if(a=="(")
		{
			s.push(1);
		}
		else if(a==")" && !s.empty())
		{
			s.pop();
		}
		else if(a=="@")
		{
			break;
		}
	}
	if(s.empty())
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
	return 0;
}

2023/7/1 00:06
加载中...