题解 100% AC
2025-06-14 11:09:47
发布于:浙江
7阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int TOP;
char a[265],x;
void push(char x){a[++TOP]=x;}
void pop(){--TOP;}
bool empty(){return TOP==0;}
int main(){
string x;cin>>x;
for(int i=0;i<x.length();i++){
if(x[i]=='(') push(x[i]);
else if(x[i]==')'){
if(!empty()) pop();
else{
cout<<"NO";
return 0;
}
}else if(x[i]=='@') break;
}
if(empty()) cout<<"YES";
else cout<<"NO";
return 0;
}
这里空空如也
有帮助,赞一个