#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int m, n; cin >> m >> n; vector<int> apples; // 读取苹果林矩阵并将每行最大值存入vector for (int i = 0; i < m; ++i) { int row_max = 0; for (int j = 0; j < n; ++j) { int current; cin >> current; if (current > row_max) { row_max = current; } } apples.push_back(row_max); } // 计算vector中的最大值和最小值 int max_apples = *max_element(apples.begin(), apples.end()); int min_apples = *min_element(apples.begin(), apples.end()); // 输出差值 cout << max_apples - min_apples << endl; return 0; } /************************************************************** Problem: 1272 User: fuyijun Language: C++ Result: Wrong Answer ****************************************************************/