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
5 2 4
19 2 16 17 3
2 5 14 17 6
13 7 9 18 15
17 3 5 2 18
7 4 19 16 13
	 
17 2 16 17 3
2 5 14 17 6
13 7 9 18 15
17 3 5 2 18
7 4 17 16 13
stdout
17 2 16 17 3 
2 5 14 17 6 
13 7 9 18 15 
17 3 5 2 18 
7 4 17 16 13