public class Main01 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); Queue<Integer> queue = new LinkedList<>(); for (int i = 0; i < n; i++) { queue.add(scanner.nextInt()); } int[] out = new int[n]; for (int i = 0; i < n; i++) { out[i] = scanner.nextInt(); } int count = 0; for (int i = 0; i < n-1; i++) { if(out[i]!=queue.peek()){ count++; }else { queue.poll(); } } System.out.println(count); } } 大佬,这样写有什么问题呀。