public static void compare(int[] A, int[] B) { int m = A.length; int n = B.length; if (m < n) { System.out.println('A表比B表小'); } else if (m > n) { System.out.println('A表比B表大'); } else { boolean equal = true; for (int i = 0; i < m; i++) { if (A[i] != B[i]) { equal = false; break; } } if (equal) { System.out.println('A表和B表相等'); } else { System.out.println('A表和B表大小相同但不相等'); } } }


原文地址: https://www.cveoy.top/t/topic/oWJe 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录