bool searchMatrix(const vector<vector<int>> &matrix, int target) { int m = matrix.size();//行 int n = matrix.front.size(); int first = 0; int last = m*n; while (first < last) { int mid = first + (last - first) / 2; //确定其中矩阵中的位置 int value = matrix[mid / n][mid%n]; if (value == target)return true; else if (target>value) first = mid + 1; else last = mid; } }