题解
2025-07-07 18:07:16
发布于:广东
5阅读
0回复
0点赞
题解:
#include<iostream>
#include<stack>
using namespace std;
stack<char>a;
int main(){
int n=0;
char b;
while(n<1){
cin>>b;
if(b=='('){
a.push('(');
}else if(b==')'){
if(a.empty()!=0){
cout<<"NO";
return 0;
}else{
a.pop();
}
}
if(b=='@'){
n++;
}
}
if(a.empty()==0){
cout<<"NO";
return 0;
}
cout<<"YES";
}
这里空空如也
有帮助,赞一个