import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); int a[] = new int[n]; for (int i = 0; i < a.length; i++) { a[i] = sc.nextInt(); } sc.nextLine(); int m = sc.nextInt(); for (int i = 0; i < a.length; i++) { if (a[i] == m) { System.out.println(i + 1); return; } } System.out.println(-1); } }
蓝桥杯 基础练习 查找整数 JAVA
最新推荐文章于 2021-09-22 15:25:22 发布