#include<iostream>
#include<algorithm>
using namespace std;
#include<cstdio>
int a[100001] = { 0 };
int main()
{
int n,count=0;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
for (int i = 1; i < n-1; i++)
{
if (a[i] < a[i - 1] && a[i+1] > a[i])
{
count++;
}
else if (a[i] > a[i - 1] && a[i + 1] < a[i])
{
count++;
}
}
cout << count;
return 0;
}
csp 201604-1 折点计数
最新推荐文章于 2024-11-12 13:55:23 发布