Parentheses Balance UVA - 673
2017-05-09 14:09
411 查看
问题类型:stack,极简主义代码~
问题链接
03pie’s solution for [UVA-673]:
问题链接
03pie’s solution for [UVA-673]:
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n;getchar();//得到n值,且吃掉回车 while(n--){ stack<char> s; char x; while((x=getchar())!='\n'&&x!=EOF){//过滤回车 if(!s.empty()&&x!=' '){ //过滤空格 if(x==')'&&s.top()=='('||x==']'&&s.top()=='[') s.pop(); else s.push(x); } else if(x!=' ') s.push(x); } if(s.empty()) cout<<"Yes\n"; else cout<<"No\n"; } return 0; }
相关文章推荐
- UVA 673 Parentheses Balance (栈)
- UVA673 Parentheses Balance【堆栈+输入流】
- (平衡的括号)Parentheses Balance UVA - 673
- uva673-Parentheses Balance
- 平衡的括号(Parentheses Balance, UVa 673)
- uva-673 Parentheses Balance
- UVa 673 - Parentheses Balance
- uva 673 - Parentheses Balance
- UVa 673 Parentheses Balance【栈】
- [UVa 673] 平衡的括号(Parentheses Balance)
- Uva 673 Parentheses Balance 平衡的括号
- 习题6-1 平衡的括号(Parentheses Balance, UVa 673)
- UVa673_ Parentheses Balance
- UVA673 Parentheses Balance
- UVa 673 - Parentheses Balance
- UVa 673 - Parentheses Balance(链表)
- UVA - 673 Parentheses Balance
- UVA673:Parentheses Balance(平衡的括号)
- UVA-673 Parentheses Balance (桟)
- uva 673 Parentheses Balance