Submission

Status:

[PPPP][P][P][P][P]

Subtask/Task Score:

{20/20}{20/20}{20/20}{20/20}{20/20}

Score: 100

User: zibozzz_23

Problemset: นก

Language: cpp

Time: 0.003 second

Submitted On: 2026-07-27 09:47:20

#include <bits/stdc++.h>
using namespace std;

int a[1005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }

    int ans = 0;
    a[0] = 0;
    for(int i = 1; i <= n; i++){
        if(a[i] > a[i-1] && a[i] > a[i+1]){
            ans ++;
        }
    }
    cout << ans << "\n";
}