90分求助
查看原帖
90分求助
911964
xzx_nwltyyds楼主2023/7/4 09:31
#include<iostream>
using namespace std;
char z[300];
char s[50];
int main(){
	cin>>z;
	int top=0,i=0;
	while(z[i]!='@'){
		if(z[i]=='('){
			s[top++]=z[i];
		}else if(z[i]==')'){
			if(s[top-1]=='('){
				top--;
			}else{
				top=1;
                i++;
				continue;
			}
		}
		i++;
	}
	if(top==0){
		cout<<"YES";
	}else{
		cout<<"NO";
	}
	return 0;
}
2023/7/4 09:31
加载中...