hopingsteam

Untitled

Apr 7th, 2020
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("bac.in");
  7.  
  8. int main()
  9. {
  10. int mat[20][20];
  11. unsigned int n, m;
  12. fin >> m >> n;
  13.  
  14. for(int i = 0; i < m; i++)
  15. for(int j = 0; j < n; j++)
  16. fin >> mat[i][j];
  17.  
  18. int nr = 0;
  19. for(int j = 1; j < n; j++)
  20. {
  21. for(int i = 0; i < m; i++)
  22. {
  23. if(mat[i][j] == mat[i][0])
  24. {
  25. nr++;
  26. break;
  27. }
  28. }
  29. }
  30. cout << n - nr - 1;
  31. return 0;
  32. }
RAW Paste Data