你说得对,但是我只对了两个点。
查看原帖
你说得对,但是我只对了两个点。
1053146
joe303楼主2024/11/1 23:01
#include <bits/stdc++.h>
using namespace std;
string a; 
long long b,c,d;
int main()
{
	cin>>a;
	for(long long i=0;i<a.size();i++)
	{
		if(a[i]=='(')
		{
			c++;
		}
		else
		{
			if(c)
			{
				c--;
			}
			else
			{
				d++;
			}
		}
	}
	cout<<c+d;
	return 0;
}
2024/11/1 23:01
加载中...