|  | 
|  | 
| back to board | AC on C++ /** Author      : Arman Sykot
 * Date & time : 28.10.2020 21:47:12 +06
 */
 
 #include <bits/stdc++.h>
 #define ll long long
 #define the_flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
 
 using namespace std;
 
 int main() {
 
 the_flash;
 
 int n;
 cin >> n;
 
 int arr[n][n];
 
 for (int i = 0; i < n; i++) {
 for (int j = 0; j < n; j++)
 cin >> arr[i][j];
 }
 
 for (int i = 0; i < n; i++) {
 for (int j = 0; j <= i; j++) {
 cout << arr[i - j][j] << " ";
 }
 }
 
 for (int i = n; i < 2 * n - 1; i++) {
 for (int j = n - 1; j >= i - (n - 1); j--)
 cout << arr[j][i - j] << " ";
 }
 
 cout << "\n";
 
 return 0;
 }
 | 
 | 
|