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); } } 大佬,这样写有什么问题呀。
点赞 4

相关推荐

10-28 10:48
已编辑
门头沟学院 Java
孩子我想要offer:发笔试后还没笔试把我挂了,然后邮箱一直让我测评没测,后面不知道干嘛又给我捞起来下轮笔试,做完测评笔试又挂了😅
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务