題目:
https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2324
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 34 35 36
| #include <iostream>
using namespace std;
int main(){ int t; cin >> t; char word; int s; for(int cases = 1; cases <= t; ++cases){ cin >> word; cin >> word; cin >> s; long long arr[s][s]; for(int i=0; i<s; ++i){ for(int j=0; j<s; ++j){ cin >> arr[i][j]; } }
bool symmetric = true; for(int i=0; i<s; ++i){ for(int j=0; j<s; ++j){ if(arr[i][j] < 0 || arr[i][j] != arr[s-i-1][s-j-1]){ symmetric = false; break; } } }
cout << "Test #" << cases << ": "; if(symmetric) cout << "Symmetric.\n"; else cout << "Non-symmetric.\n"; } return 0; }
|