#28444: CPP


11030067@mail.hpsh.tp.edu.tw (和平110級鄧雨珊)

學校 : 臺北市立和平高級中學
編號 : 163096
來源 : [61.64.210.174]
最後登入時間 :
2022-10-23 16:54:59
e513. 11349 - Symmetric Matrix -- UVA | From: [203.72.60.241] | 發表日期 : 2021-12-10 13:40

#include <iostream>
using namespace std;

int main(){
int t, c=1;
long long a[100][100];
cin >> t;
while (t--){
string s1, s2;
int n;
bool sym=true;
cin >> s1 >> s2 >> n;
for (int i=0; i<n; i++){
for (int j=0; j<n; j++){
cin >> a[i][j];
if (a[i][j]<0){
sym=false;
}
}
}
cout <<"Test #"<< c++ <<": ";
if (!sym){
cout <<"Non-symmetric.\n";
continue;
}
for (int i=0; i<=n/2; i++){
for (int j=0; j<n-i; j++){
if (a[i][j]!=a[n-1-i][n-1-j]){
sym=false;
break;
}
}
}
if (sym){
cout <<"Symmetric.\n";
}
else {
cout <<"Non-symmetric.\n";
}
}
}
 
ZeroJudge Forum