import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int m = scanner.nextInt(); int n = scanner.nextInt(); int[][] a = new int[m][n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { a[i][j] = scanner.nextInt(); } } for (int i = 0; i < m; i++) { int heng = i; int shu = 0; for (int j = 1; j < n; j++) { if (a[heng][shu] > a[i][j]) { shu = j; } } int count=0; for (int j = 0; j < n; j++) { if (a[heng][shu] > a[j][shu]) { count++; } } if (count == n - 1) { heng += 1; shu += 1; System.out.println(heng+" "+shu); } } } } |
Double click to view unformatted code.