www90分求救!回复必关!
查看原帖
www90分求救!回复必关!
1399141
longxiewen11楼主2025/1/23 14:05
#include <bits/stdc++.h>
using namespace std;
stack <char> s;
int d, e, b, c;

int main() {
	char a;
	while (a != '@') {
		a = getchar();
		if (a == '@') {
			break;
		}
		s.push(a);
	}
	while (s.empty() == 0) {
		if (s.top() == ')') {
			d--;
			while (e == 0) {
				c=1;
				e++;
			}
		}
		if (s.top() == '(') {
			d++;
			while (e == 0) {
				b=1;
				e++;
			}
		}
		s.pop();
	}
	if (d == 0) {
		if (c == 0) {
			cout << "NO";
		} else {
			cout << "YES";
		}
	} else {
		cout << "NO";
	}
}
2025/1/23 14:05
加载中...