Laitofai

13

Apr 14th, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. // 12
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n, mn, c = 0;
  9.     cin >> n;
  10.     int a[n][n];
  11.     for(int i = 0; i < n; i++){
  12.         for(int j = 0; j < n; j++){
  13.             cin >> a[i][j];
  14.             if(i == 0 && j == 0){ // если введен элемент a[0][0]
  15.                 mn = a[0][0];
  16.             }
  17.  
  18.             if(a[i][j] < mn){
  19.                 mn = a[i][j];
  20.             }
  21.         }
  22.     }
  23.  
  24.     for(int i = 0; i < n; i++){
  25.         for(int j = 0; j < n; j++){
  26.             if(a[i][j] == mn){
  27.                 if(i != j && j != (n - i - 1)){ // if()
  28.                     c++;
  29.                     cout << i << " " << j << endl;
  30.                 }
  31.             }
  32.         }
  33.     }
  34.     if(c == 0){
  35.         cout << "NO";
  36.     }
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment