You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
649 B

#include <bits/stdc++.h>
using namespace std;
int main() {
//输入二维矩阵
int n, m;
cin >> n >> m;
vector<vector<int>> twoDimensionVec;
for (int i = 0; i < n; i++) {
vector<int> oneDimensionVec;
for (int j = 0; j < m; j++) {
int c;
cin >> c;
oneDimensionVec.push_back(c);
}
twoDimensionVec.push_back(oneDimensionVec);
}
//旋转输出
for (int j = m - 1; j >= 0; j--) {
for (int i = 0; i < n; i++) {
cout << twoDimensionVec[i][j] << " ";
}
cout << endl;
}
return 0;
}