1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import java.util.Scanner; /** * UVA11349 */ public class UVA11349 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int time = sc.nextInt(); for (int i = 0; i < time; i++) { sc.next(); sc.next(); int size = sc.nextInt(); int[] matrix = new int[size * size]; int index = 0; for (int j = 0; j < size; j++) { for (int k = 0; k < size; k++) { matrix[index] = sc.nextInt(); index++; } } boolean flag = true; for (int j = 0; j <= matrix.length / 2; j++) if (matrix[j] != matrix[matrix.length - 1 - j] || matrix[j] < 0 || matrix[matrix.length - 1 - j] < 0) { flag = false; break; } System.out.printf("Test #%d: %s.\r\n", i + 1, flag ? "Symmetric" : "Non-symmetric"); } sc.close(); } } |