#26761: CPP解法分享


haoquan291 (hqn21)

School : 國立臺中第二高級中學
ID : 151199
IP address : [60.249.12.45]
Last Login :
2021-11-29 11:26:27
a015. 矩陣的翻轉 | From: [122.117.104.74] | Post Date : 2021-08-23 17:17

#include <iostream>

using namespace std;

int main() {
int x, y;
while(cin >> y >> x) {
int nums[y][x];
for(int i = 0; i < y; i++) {
for(int k = 0; k < x; k++) {
cin >> nums[i][k];
}
}
for(int i = 0; i < x; i++) {
for(int k = 0; k < y; k++) {
cout << nums[k][i] << " ";
}
cout << endl;
}
}
return 0;
}
 
ZeroJudge Forum