题解 | #矩阵转置#
矩阵转置
https://www.nowcoder.com/practice/0fe4d131737d4138912c3b5df8569245
#include <iostream> using namespace std; int matrix[101][101]; int main() { int n; while (cin >> n) { for (int i = 1; i <= n ; ++i) { for (int j = 1; j <= n ; ++j) { cin >> matrix[i][j]; } } for (int j = 1; j <= n ; ++j) { for (int i = 1; i <= n ; ++i) { cout << matrix[i][j] << " "; } cout << endl; } } }
不理解,为什么这种题属于较难