內容 :
已知一(m x n)矩陣A,我們常常需要用到另一個將A中之行與列調換的矩陣。這個動作叫做矩陣的翻轉。舉例來說,若
現在 請您針對所讀取到的矩陣進行翻轉。
A = [ 3 1 2 ] 8 5 4
則
AT = [ 3 8 ] 1 5 2 4
現在 請您針對所讀取到的矩陣進行翻轉。
輸入說明 :
第一行會有兩個數字,分別為 列(row)<100 和 行(column)<100,緊接著就是這個矩陣的內容
輸出說明 :
直接輸出翻轉後的矩陣
範例輸入 :
2 3
3 1 2
8 5 4
範例輸出 :
3 8
1 5
2 4
Dim ori(99, 99), after(99, 99) As Integer
回覆刪除Private Sub Form_Load()
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, former, latter
For i = 1 To former
For ii = 1 To latter
Input #1, ori(i, ii)
Next
Next
For iii = 1 To former
For iiii = 1 To latter
after(iiii, iii) = ori(iii, iiii)
Next
Next
For ai = 1 To latter
For bi = 1 To former
Print #2, after(ai, bi);
Next
Print #2,
Next
Close #2
Close #1
End Sub