抄
2025-05-06 20:26:42
发布于:上海
9阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int a[30000];
int b[30000];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n,m;
cin >> n >> m;
for (int i = 1; i <= n; i++){
cin >> a[i];
}
int ans = 0;
int res=0;
for (int i = 2; i < n; i++){
res = 0;
if (a[i]<a[i-1]){
res++;
}
while(i+1<n&&a[i+1] == a[i]){
i++;
}
if (a[i+1] >a[i]){
res++;
}
if (res == 2){
ans++;
}
}
cout << ans;
return 0;
}
这里空空如也
有帮助,赞一个