SHARE
TWEET

problema aia cu jumatati hatz

a guest Nov 13th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.   int n;
  6.   cin >> n;
  7.   int mt[n][n];
  8.   for(int i = 0; i < n; i++) {
  9.     for(int j = 0; j < n; j++) {
  10.       cin >> mt[i][j];
  11.     }
  12.   }
  13.   int k = n - 1;
  14.   for(int i = 0; i < n; i++) {
  15.     for(int j = 0, l = n - 1; j < n; j++) {
  16.       if(i + j + 1 <= n + 1 && k + l + 1 >= n) {
  17.         mt[k][l] = mt[i][j];
  18.       }
  19.       l--;
  20.     }
  21.     k--;
  22.   }
  23.   for(int i = 0; i < n; i++) {
  24.     for(int j = 0; j < n; j++) {
  25.       cout << mt[i][j] << " ";
  26.     }
  27.     cout << "\n";
  28.   }
  29.   return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top