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. int egal = 0;
  13. for (int i = 1; i <= n; ++i) {
  14. for (int j = 1; j <= n; ++j) {
  15. if (mat[i][j] == mat[i][j + 1]) {
  16. ++egal;
  17. if (mat[i][j] == 0 && egal == 3) {
  18. cout << "jucatorul 0";
  19. } else if (mat[i][j] == 1 && egal == 3) {
  20. cout << "jucatorul X";
  21. }
  22. }
  23. }
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5284KB
stdin
3
1 1 1
2 0 0
0 0 2
stdout
jucatorul 0