// 2022 IUSB Programming Competition // Round 1 Problem 6 // 2D-Array Traversal // Solution by Liguo Yu #include using namespace std; void print(int ** a, int x, int y); void rotate_copy(int ** a, int ** b, int x, int y); int main() { int m, n; cin >> m; cin >> n; int ** a = new int *[m]; // m rows for (int i = 0; i < m; i++) { a[i] = new int[n]; // each row is an int array } for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { cin >> a[i][j]; } } print(a, m, n); return 1; } void print(int ** a, int row, int col) { for(int c=0; c 1) { int ** b = new int * [col]; for (int i = 0; i < col; i++) { b[i] = new int[row-1]; } rotate_copy(a, b, row, col); print(b, col, row-1); } } // copy array a to array b without first row // through counter-clockwise rotating 90 degrees void rotate_copy(int ** a, int ** b, int row, int col) { for(int i=1; i