#include <bits/stdc++.h>
using namespace std;
int main()
{
// 请在此输入您的代码
int n;
cin>>n;
stack<char> stk;
int judge=1;
while(n--)
{
char x;
cin>>x;
if(x=='(')
stk.push('(');
else if(stk.size()) stk.pop();
else
{
judge=0;//余右括号,判断
break;
}
}
if(stk.size()) judge=0;//余左括号,判断
if(judge) cout<<"Yes";
else cout<<"No";
return 0;
}
03-03
441
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-21
428
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-08
477
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-24
972
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-22