fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, mat[4][4];
  6. cin >> n;
  7. for (int i = 1; i <= n; ++i) {
  8. for (int j = 1; j <= n; ++j) {
  9. cin >> mat[i][j];
  10. }
  11. }
  12. for (int i = 1; i <= n; ++i) {
  13. int egal = 0;
  14. int aux = mat[i][n];
  15. for (int j = 1; j <= n; ++j) {
  16. if (aux == mat[i][j]) {
  17. ++egal;
  18. }
  19. if (egal > 2) {
  20. if (mat[i][j] == 1) {
  21. cout << "jucatorul X";
  22. return 0;
  23. } else if (mat[i][j] == 0) {
  24. cout << "jucatorul 0";
  25. return 0;
  26. }
  27. }
  28. }
  29. cout << egal << " ";
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5284KB
stdin
3
1 0 1
2 0 1
1 2 0
stdout
2 1 1