x2311

Untitled

Dec 21st, 2021
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.09 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const int SIZE = 6;
  6.  
  7. int main() {
  8.     int arr[][SIZE]{
  9.             {17, 6,  17, 8,  7,  17},
  10.             {7,  5,  4,  65, 9,  48},
  11.             {1,  1,  4,  0,  6,  96},
  12.             {7,  3,  4,  5,  53, 0},
  13.             {0,  -1, 4,  5,  73, 14},
  14.             {1,  -2, 4,  5,  74, 9},
  15.  
  16.     };
  17.  
  18.     for (int i = 0; i < sizeof(arr) / SIZE / sizeof(int); i++) {
  19.         int firstNumber = arr[i][0];
  20.         int minimumСoordinate = 0;
  21.  
  22.         for (int j = 0; j < SIZE; j++) {
  23.             if (firstNumber > arr[i][j]) {
  24.                 firstNumber = arr[i][j];
  25.                 minimumСoordinate = j;
  26.             }
  27.         }
  28.         int smallestNumberInARow = arr[i][minimumСoordinate];
  29.  
  30.         firstNumber = arr[0][minimumСoordinate];
  31.         for (auto & j : arr) {
  32.             if (j[minimumСoordinate] >= firstNumber) {
  33.                 firstNumber = j[minimumСoordinate];
  34.             }
  35.         }
  36.         if (smallestNumberInARow == firstNumber) {
  37.             cout << endl << i+1 << "-" << minimumСoordinate+1;
  38.         }
  39.     }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment