大神们,我错哪了,求调
#include<bits/stdc++.h>
using namespace std;
int ans;
int main()
{
int n;
cin >> n;
int a[n]={0};
int fin = 0;
for(int i = 0;i < n;i++)
{
cin >> a[n];
fin+=a[n];
}
if(fin == 0)
{
cout << 0;
return 0;
}
ans = 0;
for(int i = 1;i < n;i++)
{
if(a[i-1] > a[i] && a[i+1] >a[i])
{
ans++;
}
else if(a[i-1] > a[i] && i != 0)
{
for(int j = i+1;j <= n;j++)
{
if(a[j] > a[i])
{
ans++;
break;
}
}
}
}
cout <<ans;
return 0;
}