- ()的传送门
- 还是水博客
- 代码在此
#include<bits/stdc++.h>
using namespace std;
char s[300],c;
int t;
int main()
{
while(cin>>c){
if(c=='('||c=='[')
s[++t]=c;
else if(c==')'&&s[t]=='(') t--;
else if(c==']'&&s[t]=='[') t--;
else{
t=-1;
break;
}
}
if(t==0) cout<<"OK\n";
else cout<<"Wrong\n";
return 0;
}
- 网站为什么总要给我加动态规划的标签?好烦啊