Submission

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

Score: 100

User: GUGUGGUGUG

Problemset: นก

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-27 17:40:03

#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll maxn = 1005;
const ll inf = 1e18;

ll arr[maxn];

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

    ll n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> arr[i];
    }
    
    ll cnt = 0;

    for (int i = 1; i <= n; i++) {
        if (arr[i] > arr[i-1] && arr[i] > arr[i+1]) {
            cnt++;
        }
    }

    cout << cnt;

    return 0;
}