题解 CF1469A 【Regular Bracket Sequence】

这题谁翻译的!!!

害,一开始看着翻译以为要贪心……

结果看了看题解说中间只会有1个左括号与1各右括号。

代码:

#include <iostream>
#include <string>
using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int T;
    cin >> T;
    while(T--)
    {
        string s;
        cin >> s;
        if(s.front() != ')' && s.back() != '(' && !(s.length() & 1)) cout << "yEs\n";
        else cout << "nO\n";
    }
    return 0;
}
posted @ 2021-01-04 17:44  HappyBobb  阅读(8)  评论(0)    收藏  举报  来源