Skip to content

Instantly share code, notes, and snippets.

@peter279k
Created December 22, 2015 02:05
Show Gist options
  • Save peter279k/3e5208459eef0e09f93d to your computer and use it in GitHub Desktop.
Save peter279k/3e5208459eef0e09f93d to your computer and use it in GitHub Desktop.
import java.util.*;
public class main{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int number = input.nextInt();
int count = 1;
for(int i=1;i<=number;i++) {
input.next();
input.next();
int num = input.nextInt();
long []matrix = new long[num*num];
int mid = (num*num+1) / 2;
for(int j=0;j<num*num;j++) {
matrix[j] = input.nextLong();
}
int k= 1;
boolean check = false;
for(int j=0;j<matrix.length;j++) {
if(matrix[j] < 0) {
check = true;
break;
}
}
if(check) {
System.out.println("Test #" + count + ": Non-symmetric.");
count += 1;
continue;
}
for(int j=0;j<matrix.length;j++) {
if(matrix[j] != matrix[matrix.length-k]) {
check = true;
break;
}
if(mid == j)
break;
k++;
}
if(check) {
System.out.println("Test #" + count + ": Non-symmetric.");
}
else {
System.out.println("Test #" + count + ": Symmetric.");
}
count++;
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment