求助 ! ! !
查看原帖
求助 ! ! !
390568
Twistzz__楼主2023/10/29 20:00

求助 洛谷

听同学说洛谷是linux的?什么东西

不太清楚,在Dev上可以过但是好像洛谷上是十个RE

也不知道咋回事

有大佬帮我看看吗

#include<bits/stdc++.h>
using namespace std;
string a;
stack<char> b;
int main(){
	cin>>a;
	for(int i=0;i<a.length();i++){
		if(a[i]=='(' || a[i]==')'){
			char x=b.top();
			if(x=='(' && a[i]==')')b.pop();
			else b.push(a[i]);	
		}
	}
	if(!b.empty())cout<<"NO";
	else cout<<"YES";
	return 0;
}
2023/10/29 20:00
加载中...