Submission

Status:
[PPPP][P][P][P][P]

Score: 100

User: putter_nopanat

Problemset: นก

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-30 17:23:00

#include<iostream>
using namespace std;
int main(){
    int n ;
    int cnt = 0;
    cin >> n;
    int h[n+2];
    h[0] = 0;
    h[n+1] = 0;
    for(int i = 1;i<=n;i++){
        cin >> h[i];
    }
    for(int i = 1;i<=n;i++){
        if(h[i]>h[i+1] && h[i] > h[i-1]){
            cnt += 1;
        }
    }
    cout << cnt;

}