#include #include using namespace std;

int main() { int N; cin >> N; vector heights(N); for (int i = 0; i < N; i++) { cin >> heights[i]; }

int count = 0;
for (int i = 0; i < N; i++) {
    int before = 0;
    int after = 0;
    for (int j = 0; j < i; j++) {
        if (heights[j] > heights[i]) {
            before++;
        }
    }
    for (int j = i + 1; j < N; j++) {
        if (heights[j] > heights[i]) {
            after++;
        }
    }
    if (before == after) {
        count++;
    }
}

cout << count << endl;

return 0;

}

KKT数组403比身高 - C++解题思路与代码

原文地址: https://www.cveoy.top/t/topic/qk0g 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录