zoj 3809 枚举水题 (2014牡丹江网赛 A题)

题目大意:给出一列取样的几个山的高度点,求山峰有几个?

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 ;
}
上一篇:Capture the Flag ZOJ - 3879(模拟题)


下一篇:solr6.3 + Hbase Indexer使用MR创建索引,错误Bad return type