Transpose Matrix


Submit solution

Points: 35 (partial)
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem types
Allowed languages
Java 19, Java 8

題目說明

輸入二維陣列,輸出轉置矩陣

【轉置矩陣】
把\(A\)的行寫為\(A^T\)的列
把\(A\)的列寫為\(A^T\)的行

輸入

二維陣列的row、column,

接著依row順序輸入陣列內的值(皆為整數)

輸出

依column順序輸出轉置矩陣

sample input1

3 2
6 8
9 8
4 1

// 大小為3*2的陣列

sample output1

6 9 4 
8 8 1

sample input2

2 2
5 6
4 3

sample output2

5 4 
6 3

sample input3

2 3
6 3 9
5 4 2

sample output3

6 5 
3 4 
9 2

Comments

There are no comments at the moment.