1 static int wing=[]()
 2 {
 3     std::ios::sync_with_stdio(false);
 4     cin.tie(NULL);
 5     return 0;
 6 }();
 7 
 8 class Solution 
 9 {
10 public:
11     bool isToeplitzMatrix(vector<vector<int>>& matrix) 
12     {
13         int row=matrix.size();
14         int col=matrix[0].size();
15         for(int i=0;i<row;i++)
16         {
17             for(int j=0;j<col;j++)
18             {
19                 for(int x=i,y=j;x<row&&y<col;x++,y++)
20                 {
21                     if(matrix[x][y]!=matrix[i][j])
22                         return false;
23                 }
24             }
25         }
26         return true;
27     }
28 };

一个一个元素扫描判定即可,问题不大

posted on 2018-06-13 10:34  高数考了59  阅读(131)  评论(0)    收藏  举报