STANAANDREY

bacT4 sIII 2

May 18th, 2021
505
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int a[22][22], n, m;
  4.  
  5. void read() {
  6.     cin >> m >> n;
  7.     for (int i = 1; i <= m; i++) {
  8.         for (int j = 1; j <= n; j++) {
  9.             cin >> a[i][j];
  10.         }
  11.     }
  12. }
  13.  
  14. bool arecompl(int col1, int col2) {
  15.     for (int line = 1; line <= m; line++) {
  16.         if (a[line][col1] == a[line][col2]) {
  17.             return false;
  18.         }
  19.     }//*/
  20.     return true;//*/
  21. }
  22.  
  23. int main() {
  24.     read();
  25.     int ans = 0;
  26.     for (int col = 2; col <= n; col++) {
  27.         if (arecompl(1, col)) {
  28.             ans++;
  29.         }
  30.     }
  31.     cout << ans << endl;
  32.     return 0;
  33. }
  34.  
RAW Paste Data