收到时间飞逝开始的人格人吧v忽然深V发吧
2025-01-15 20:47:58
发布于:江苏
0阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
char a[1000];
stack<char>stk;
int main(){
cin>>a;
for(int i=0;i<strlen(a);i++){
if(a[i]')'){
if(!stk.empty()){
stk.pop();
}else{
cout<<"NO";
return 0;
}
}
if(a[i]'('){
stk.push('(');
}
}
if(stk.empty()){
cout<<"YES";
}else{
cout<<"NO";
}
return 0;
}
这里空空如也
有帮助,赞一个