---------------------------------------------------------------------
注意看清楚条件 别漏了
-1
-1
-1
---------------------------------------------------------------------
算法
1 import java.util.*; 2 public class Main { 3 public static void main(String[] args) { 4 Scanner sc = new Scanner(System.in); 5 int n = sc.nextInt(); 6 int[] a = new int[n]; 7 for(int i=0;i<n;i++) 8 a[i] = sc.nextInt(); 9 int s = sc.nextInt(); 10 boolean b = true; 11 for(int i=0;i<n;i++) 12 if(a[i]==s){ 13 b = false; 14 System.out.println(i+1); 15 break; 16 } 17 if(b) 18 System.out.println(-1); 19 } 20 }