nyoj 2
来源:互联网 发布:伊藤园三得利 知乎 编辑:程序博客网 时间:2024/05/24 05:12
#include <iostream>#include <stack>#include <string.h>#include <stdio.h>using namespace std;char a[10001];int main(){ int i,t,flag,n; cin>>t; getchar(); stack<char> s; while(t--) { cin.getline(a,10001); n=strlen(a); s.push(a[0]); flag=1; for(i=1;i<n;i++) { //if((a[i]==')'||a[i]==']')&&s.empty()) //{flag=0;break;} if(s.top()=='('&&a[i]==')') {/*cout<<s.top()<<endl; */s.pop();} else if(s.top()=='['&&a[i]==']') {/*cout<<s.top()<<endl; */s.pop();} else s.push(a[i]); } //cout<<endl; //cout<<s.top()<<endl; // s.pop(); // cout<<s.empty()<<endl; if(s.empty()&&flag) cout<<"Yes\n"; else cout<<"No\n"; while(!s.empty())s.pop(); } return 0;}
0 0
- nyoj-2
- NYOJ 2
- NYOJ 2
- nyoj 2
- NYOJ 2
- NYOJ 2
- nyoj 2-括号匹配
- nyoj 2 括号匹配
- NYOJ 2【栈模拟】
- nyoj 2 括号配对
- nyoj 2 括号配对
- nyoj-2括号匹配
- nyoj--2--括号配对
- NYOJ-2 括号匹配
- 括号匹配 NYOJ 2
- NYOJ 2 括号配对
- NYOJ
- NYOJ
- redis渐入佳境(05) zset类型
- System.getProperty("user.dir")方法
- Ext.form.ComboBox 本地和远程模式的基本定义
- 【SVN】SVN设置日志提交限制和日志模板设置(windows下)
- C11新特性
- nyoj 2
- MFC的一些类
- iOS应用性能调优的25个建议和技巧
- iOS 5 Storyboard 学习之 Tabbar Controller,Navigation Controller (3)
- MediaPlayer中创建AudioTrack的过程
- Lua中的require
- 用LED矩阵屏 显示网络摄像头图像
- mysql查询结果添加序列号
- Android代码规范