为什么一定要用queue呢;
~~虽说STL大法好~~
这样写不好吗
```cpp
#include<bits/stdc++.h>
using namespace std;
char sign;
int flag;
int main(){
while(cin>>sign){
if(sign=='(')
flag++;
if(sign==')')
flag--;
if(flag<0){
cout<<"NO";
return 0;
}
if(sign=='@')
break;
}
if(!flag)
cout<<"YES";
else
cout<<"NO";
return 0;
}
```
简单易懂QWQ
by 又双叒叕 @ 2018-11-08 19:10:45
input文件我也下载不了,output是“NO”
by 又双叒叕 @ 2018-11-08 19:17:51
支持楼上的代码
另外一个,不需要判断是否在输入sign,直接判断sigh是否为"@"就行了QAQ
```cpp
#include <iostream>
using namespace std;
int main(){
int s;
char x;
cin>>x;
s=0;
while(x!='@'){
if(x=='('){
s++;
}
if(x==')'){
s--;
if(s<0){
cout<<"NO"<<endl;
return 0;
}
}
cin>>x;
}
if(s!=0){
cout<<"NO"<<endl;
}
else{
cout<<"YES"<<endl;
}
return 0;
}
```
by 其实我是蒟蒻 @ 2018-12-03 21:32:43
这种解法是错的,如果先输入),在输入(,楼上代码输出是yes事实上应该是no
by 是你的七七 @ 2018-12-26 14:48:47