求助,为什么全RE
查看原帖
求助,为什么全RE
543206
shiroko2008楼主2022/1/18 12:56
#include<iostream>
#include<stack>
#include<string>
using namespace std;
int main()
{
	char s[1000];
	int i=0;
	cin>>s;
	stack<char> t;
	while(s[i]!='@') {
		if (s[i]=='(') t.push(s[i]);
		else {
			if (s[i]=')') {
				if (t.top()=='(') t.pop();
				else {
					cout<<"NO";
					return 0;
				}
			}
		}
		i++;
	}
	if (!t.empty())cout<<"YES"; else cout<<"NO";
	return 0;
}
2022/1/18 12:56
加载中...