#include<bits/stdc++.h>
using namespace std;
char c;
int a;
int main()
{
while((c=getchar())!='\n'){
if(c=='('){
a++;
}
else if(c==')'){
a--;
if(a<0){
cout<<"NO";
return 0;
}
}
}
if(a==0) cout<<"YES";
else cout<<"NO";
return 0;
}
只能得50分,TLE#1#2#4#5#8,#1的数据我下载了,直接手动输入只用0.3秒,但是换成文件却一直不输出。第一次碰到这样的问题。