对称矩阵【华中科技大学】

mac2022-06-30  20

简单题

#include <iostream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <queue> #include <cstdio> #include <cctype> #include <unordered_map> #include <map> using namespace std; const int N = 105; typedef pair<int, string> PII; int arr[N][N]; bool isSys(int n){ for(int i = 0; i < n; i++){ for(int j = 0; j < i; j++){ if(arr[i][j] != arr[j][i]) return false; } } return true; } int main() { int n; while(cin>>n){ for(int i = 0; i < n; i++){ for(int j =0; j < n; j++){ cin>>arr[i][j]; } } if(isSys(n)) cout<<"Yes!"<<endl; else cout<<"No!"<<endl; } return 0; }
最新回复(0)