2 条题解

  • 0
    @ 2025-3-22 14:20:20
    #include<bits/stdc++.h> 
    using namespace std;
    bool isVowel(char c){
        c = tolower(c);
        return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';
    }
    
    int main() {
        string s;
        cin >> s;
    
        int len = s.length();
        if (len % 2 != 0 || len > 1000) return 1;
    
        int mid = len / 2;
        int count1 = 0, count2 = 0;
    
        for (int i = 0; i < mid; i++) {
            if (isVowel(s[i])) count1++;
        }
        for (int i = mid; i < len; i++) {
            if (isVowel(s[i])) count2++;
        }
    
        if (count1 == count2) {
            std::cout << "YES";
        } else {
            std::cout << "NO";
        }
    
        return 0;
    }

    信息

    ID
    2113
    时间
    1000ms
    内存
    256MiB
    难度
    3
    标签
    递交数
    72
    已通过
    17
    上传者