fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 10;
  5.  
  6. int main() {
  7. int n, mt[MAX_SIZE + 1][MAX_SIZE + 1];
  8. cin >> n;
  9. for (int i = 1; i <= n; ++i) {
  10. for (int j = 1; j <= n; ++j) {
  11. cin >> mt[i][j];
  12. }
  13. }
  14. ++n;
  15.  
  16. for (int i = n; i > 1; --i) {
  17. for (int j = 1; j < n; ++j) {
  18. if (i > n /2 + 1) {
  19. mt[i][j] = mt[i - 1][j];
  20. }
  21. if (i == n / 2 ) {
  22. mt[i][j] = mt[j][n - 1];
  23. }
  24. }
  25.  
  26. }
  27.  
  28. for (int i = 1; i <= n; ++i) {
  29. for (int j = 1; j < n; ++j) {
  30. cout << mt[i][j] <<" ";
  31. }
  32. cout <<"\n";
  33. }
  34.  
  35.  
  36.  
  37. return 0;
  38. }
Success #stdin #stdout 0s 5284KB
stdin
4
44 51 68 20
89 65 45 56
12 10 56 23
98 99 14 66
↓
stdout
44 51 68 20 
20 56 23 23 
12 10 56 23 
12 10 56 23 
98 99 14 66