60分RE求助
查看原帖
60分RE求助
730917
hrk_楼主2023/1/10 12:43

提交记录:https://www.luogu.com.cn/record/99224998

#include<bits/stdc++.h>
using namespace std;
	stack<char>a;
int main(){
	char m;
	while(m!='@'){
		cin>>m;
		if(m=='('){
			a.push(m);
		}else if(m==')'&&a.top()=='('){
			a.pop();
		}
	}
	if(a.size()==0){
		cout<<"YES";
	}else{
		cout<<"NO";
	}
	return 0;
}

用栈做的

2023/1/10 12:43
加载中...