#7#9不对,大神求助
查看原帖
#7#9不对,大神求助
772478
Wisdom_chicken_god楼主2022/8/17 14:39
#include<bits/stdc++.h>

using namespace std;

string kuo;

bool you=1;

int num,qwe;
int main(){
	cin>>kuo;
	num=kuo.length();
	if(kuo[0]==')'){
		cout<<"NO";
		return 0;
	}
	for(int i=0;i<=num;i++){
		if(you==1&&kuo[i]==')'){
			cout<<"NO";
			return 0;
		}
		if(kuo[i]=='('){
			qwe++;
		}
		else if(kuo[i]==')')
		qwe--;
		if(qwe>0)
		you=0;
	}
	if(qwe!=0){
		cout<<"NO";
		return 0;
	}
	cout<<"YES";
	return 0;
}```
2022/8/17 14:39
加载中...