1 条题解
-
0
#include <iostream> #include <vector> using namespace std; vector<int> nums(int arr[5][5]) { vector<int> v; for (int j = 0; j < 5; j++) { int row_max = arr[j][0]; int col = 0; for (int i = 0; i < 5; i++) { if (row_max < arr[j][i]) { row_max = arr[j][i]; col = i; } } int col_min = arr[0][col]; for (int i = 0; i < 5; i++) { col_min = col_min > arr[i][col] ? arr[i][col] : col_min; } if (row_max == col_min) { v.push_back(j+1); v.push_back(col+1); v.push_back(row_max); } } return v; } int main() { int arr[5][5] = { {11, 3, 5, 6, 9}, {12, 4, 7, 8, 10}, {10, 5, 6, 9, 11}, {8, 6, 4, 7, 2}, {15, 10, 11, 20, 25}}; vector<int> v = nums(arr); for (int i : v) { cout << i << " "; } cin.get(); }
- 1
信息
- ID
- 621
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 9
- 标签
- (无)
- 递交数
- 30
- 已通过
- 3
- 上传者