Files
some-cpp-files/Miscellaneous/matrix_transposition.cpp
T
2024-03-17 22:30:49 +08:00

26 lines
326 B
C++

#include <bits/stdc++.h>
using namespace std;
int main() {
int h, w;
scanf("%d %d", &h, &w);
int a[h][w], b[w][h];
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
scanf("%d", &a[i][j]);
}
}
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
b[i][j] = a[j][i];
}
}
return 0;
}