第三、六、七、九个点RE
查看原帖
第三、六、七、九个点RE
91975
GVNDN楼主2020/5/31 21:44
#include<iostream>
#include<string>
#include<stack>
using namespace std;

stack<int> s;
string a;

int main(){
	int ok = 1;
	cin >> a;
	for(int i = 0; i < a.length(); i++){
		if(a[i] == '(')
			s.push(a[i]);
		else if(a[i] == ')'){
			if(s.top() == '(')
				s.pop();
			else{
				ok = 0;
				break;
			}
		}
	}
	if(ok && s.empty()) cout << "YES";
	else cout << "NO"; 
	return 0;
}

但是在本地手动输入数据却可以得出正确答案,怎么回事?求大佬解答!谢谢~~

2020/5/31 21:44
加载中...