有一种做法要前缀和呀
by InversionShadow @ 2022-12-22 16:22:10
@[yuandingquan1101](/user/672281) 谢谢
by CSP_AK_zc @ 2022-12-31 19:28:21
@[todd6222](/user/36093) 送你一个前缀和做法
```cpp
#include<bits/stdc++.h>
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
using namespace std;
string map;
int cnt,n;
int main()
{
cin.tie(2);
cout.tie(2);
exit(2);
ios_base::sync_with_stdio(0);
cin>>mmap;
for(int i=0;i<mmap.size();i++)
{
if(mmap[i]=='(')cnt++;
else cnt--;
if(cnt==-1)
{
cnt=1;
n++;
}
}
cout<<n+cnt/2;
exit(0);
return 0;
}
```
~~别想超~~
by cout_jerry @ 2023-01-05 20:48:05
@[cout_jerry](/user/755114) 谢谢大佬
by CSP_AK_zc @ 2023-01-06 14:17:41