a015: 矩陣的翻轉https://zerojudge.tw/ShowProblem?problemid=a015
從對角線對稱翻轉,所以把arr[i][j]填入arr[j][i]即可
Allen(AC)
#include <iostream>
using namespace std;
int main() {
int arr[100][100];
int x, y;
while (cin >> x >> y) {
for (int i= 0; i < x;i++){
for (int j= 0; j < y;j++){
cin >> arr[i][j];
}
}
for (int i= 0; i < y;i++){
for (int j= 0; j < x;j++){
cout << arr[j][i] << " ";
}
cout << endl;
}
}
return 0;
}