Aleksandr_Grigoryev

Седловая точка

Feb 19th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     const int n=3, m=4;
  8.     int a[n][m], t = 0;
  9.     int sedlo;
  10.     for (int i = 0; i < n; i++)
  11.     {
  12.         for (int j=0; j <m;j++)
  13.         cin>> a[i][j];
  14.     }
  15.  
  16.     int min,max;
  17.     for (int i = 0; i < n; i++)
  18.     {
  19.         min = a[i][0];
  20.         for (int j = 1; j < m; j++)
  21.         {
  22.             if (a[i][j] < min)
  23.                 min = a[i][j];
  24.         }
  25.         for (int j = 0; j < m; j++)
  26.         {
  27.             if (min == a[i][j])
  28.             {
  29.                 max = a[0][j];
  30.                 for (int k = 0; k < n; k++)
  31.                 {
  32.                     if (max > a[k][j])
  33.                     {
  34.                         k++;
  35.  
  36.                         if (min == max)
  37.                         {
  38.                             sedlo = max;
  39.                             t++;
  40.                         }
  41.                     }
  42.                 }
  43.                
  44.             }
  45.            
  46.         }
  47.        
  48.     }
  49.         cout << "sedlovaya tochka =" << sedlo;
  50.         cout << "kol-vo= " << t;
  51.     system("pause");
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment