题目大意:给出一列取样的几个山的高度点,求山峰有几个?
Sample Input
2
9
1 3 2 4 6 3 2 3 1
5
1 2 3 4 5
Sample Output
3
0
# include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
# include <cmath>
# define LL long long
using namespace std ; int a[] ; int main ()
{
//freopen("in.txt","r",stdin) ;
int T ;
cin>>T ;
while(T--)
{
int n ;
int i ;
cin>>n ;
for (i = ; i <= n ; i++)
cin>>a[i] ;
int sum = ;
for (i = ; i <= n- ; i++)
{
if (a[i] > a[i-] && a[i] > a[i+])
sum++ ;
}
cout<<sum<<endl ;
} return ;
}