60分4WA求调
查看原帖
60分4WA求调
1405742
Aix_Eric楼主2024/8/10 16:07
#include <cstdio>
#include <stack>
using std::stack;
const int N = 260;
char a[N];
int main(){
	stack <char> s;
	scanf("%s", a);
	int i = 0;
	while(a[i] != '@'){
		if(a[i] == '(' ) s.push('(');
		if(a[i] == ')'){
			if(s.empty()){
				printf("No");
				return 0;
			}else s.pop();
		}
		i++;
	}
	if(s.empty()) printf("YES");
	else printf("NO");
	return 0;
}
2024/8/10 16:07
加载中...