纯模拟
#include <iostream>
using namespace std;
const int N = 150;
int a[N];
int n;
int main()
{
while (cin >> n)
{
for (int i = 0; i < n; ++i)
cin >> a[i];
//特判左
if (a[1] > a[0] || a[1] < a[0])
cout << 0 << " ";
for (int i = 1; i < n - 1; ++i)
{
int l = i - 1, r = i + 1;
if (a[l] > a[i] && a[r] > a[i])
cout << i << " ";
else if (a[l] < a[i] && a[r] < a[i])
cout << i << " ";
}
//特判右
if(a[n-2] > a[n-1] || a[n-2] < a[n-1])
cout << n - 1 << " ";
cout << endl;
}
return 0;
}