随便写写
#include<iostream> #include<string.h> using namespace std; char arr[1005]; int main() { int num=0; cin>>arr; for(int i=0;i<strlen(arr);i++) { if(arr[i]==')') num++; if(arr[i]=='(') num--; } if(num==0) cout<<"YES"; else cout<<"NO"; return 0; }
By signing up a 追梦算法网 universal account, you can submit code and join discussions in all online judging services provided by us.
Using your 追梦算法网 universal account