蒟蒻60 RE求助!
查看原帖
蒟蒻60 RE求助!
768436
Ying_Sophia楼主2023/10/12 20:50

感谢大佬!!

#include<bits/stdc++.h>
using namespace std;
stack <char> s;
char a[300];
int len;

int main(){
    cin>>a;
    len=strlen(a);
    for(int i=0;i<len;i++){
    	if(a[i]=='(') s.push(a[i]);
    	if(a[i]==')'){
    		if(s.top()=='(') s.pop();
		}
	}
	if(s.empty()) printf("YES");
	else printf("NO");
    return 0;
}
2023/10/12 20:50
加载中...