fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n, a[1005];
  4. int main(){
  5. cin >> n;
  6. for (int i = 0; i < n; i++) cin >> a[i];
  7. for (int i = 1; i < n -1; i++){
  8. if (a[i] < a[i - 1] && a[i] < a[i + 1]) cout << a[i] << " ";
  9. }
  10. return 0;
  11. }
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
Standard output is empty