文章
70
粉丝
0
获赞
272
访问
48.9k
#include<stdio.h>
#include<iostream>
#include<stack>
#include<string>
using namespace std;
// {[(<>)]}
bool check(string s){
stack<char> St;
for(int i=0; i<s.length(); i++){
if(St.empty()){
St.push(s[i]);
continue;
}
if(s[i]=='<') St.push(s[i]); //'<'最里面,可以直接压栈
else if(s[i]=='(' && St.top()!='<') St.push(s[i]);
else if(s[i]=='[' && St.top()!='(' && St.top()!='<') St.push(s[i]);
else if(s[i]=='{'
&nb...
登录后发布评论
暂无评论,来抢沙发