fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. class Ideone
  6. {
  7. public static void main (String[] args)
  8. {
  9. int n;
  10. Scanner s = new Scanner(System.in);
  11. n = s.nextInt();
  12. double[] x = new double[n];
  13. for(int i=0; i<n; i++){
  14. x[i]=s.nextInt();
  15. }
  16. for(int j=1; j<=(n-2); j++){
  17. if((x[j]>x[j+1])&&(x[j]>x[j-1])){
  18. System.out.println(j + " ");
  19. }
  20. }
  21. }
  22. }
Success #stdin #stdout 0.06s 4386816KB
stdin
6
2 4 6 1 3 7 5
stdout
2