题解
2024-02-17 11:48:47
发布于:广东
7阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
		cin>>s;
    int i=0,top=0,flag=0;
    while(s[i]!='@'){
		if(s[i]=='(') top++;
        if(s[i]==')') top--;
        if(top<0){
            flag=1;
            break;
        }
        i++;
    }              
    if(top!=0) flag = 1;
    if(flag==0) cout<<"YES";
    else cout<<"NO";
	return 0;
}
这里空空如也

有帮助,赞一个