//土尔逊Torson 编写于2023/4/14 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> using namespace std; const int kMAX = 81; int main() { int k; int arr[kMAX]; while (scanf("%d", &k) != EOF) { for (int i = 0; i < k; ++i) { scanf("%d", &arr[i]); } for (int i = 0; i < k; ++i) { if (0 == i) { if (arr[i] > arr[i + 1] || arr[i] < arr[i + 1]) { printf("%d ", i); } } else if (k - 1 == i) { if (arr[i] > arr[i - 1] || arr[i] < arr[i - 1]) { printf("%d ", i); } } else { if ((arr[i] > arr[i - 1] && arr[i] > arr[i + 1]) || (arr[i] < arr[i - 1] && arr[i] < arr[i + 1])) { printf("%d ", i); } } } printf("\n"); } system("pause"); return EXIT_SUCCESS; } // 64 位输出请用 printf("%lld")