import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int n;
n=scanner.nextInt();
int[] arr=new int[n];
for (int i = 0; i < n; i++) {
arr[i]=scanner.nextInt();
}
int a=scanner.nextInt();//目标数
int position=0;
for(int i=0;i<n;i++){
if (arr[i]==a) {
position=i+1;
break;
}else {
position=-1;
}
}
System.out.println(position);
}
}
蓝桥杯JAVA 查找整数
最新推荐文章于 2022-01-02 20:27:27 发布