题解(栈解法)
2023-07-16 11:09:15
发布于:浙江
44阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
char s[265];
int TOP=0;
int main(){
char x;
while(cin>>x){
if(x=='@') break;
if(TOP==0){
if(x==')'){
cout<<"NO";
return 0;
}
}if(x=='(')s[++TOP]=x;
if(x==')')--TOP;
}if(TOP==0) cout<<"YES";
else cout<<"NO";
return 0;
}
这里空空如也
有帮助,赞一个