fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 10;
  5.  
  6. int main() {
  7. int size, linePos, colPos, maxElement = 0, mt[MAX_SIZE + 1][MAX_SIZE + 1];
  8. cin >> size >> linePos >> colPos;
  9. for (int line = 1; line <= size; ++line) {
  10. for (int col = 1; col <= size; ++col) {
  11. cin >> mt[line][col];
  12. if (mt[line][col] > maxElement) {
  13. maxElement = mt[line][col];
  14. }
  15. }
  16. }
  17. for (int line = 1; line <= size; ++line) {
  18. for (int col = 1; col <= size; ++col) {
  19. if (mt[line][col] == maxElement) {
  20. mt[line][col] =mt[linePos][colPos];
  21. }
  22. cout << mt[line][col] << " ";
  23. }
  24. cout << "\n";
  25. }
  26. return 0;
  27. }
Success #stdin #stdout 0.01s 5288KB
stdin
3 2 3
7 9 9
3 2 1
9 4 3
stdout
7 1 1 
3 2 1 
1 4 3