spin matrix


Submit solution

Points: 50 (partial)
Time limit: 1.0s
Memory limit: 256M

Authors:
Problem type
Allowed languages
Java 19, Java 8

題目說明

輸入一個3*3的二元矩陣,接下來輸出一整數0或1

若輸入0則將矩陣順時針轉一次並輸出二元矩陣,若輸入1則逆時針轉一次並輸出二元矩陣

輸入

3*3矩陣 0或1

輸出

旋轉後的陣列

sample input1

1 2 3 4 5 6 7 8 9 0

sample output1

7 4 1 8 5 2 9 6 3

sample input2

1 2 3 4 5 6 7 8 9 1

sample output2

3 6 9 2 5 8 1 4 7

Comments

There are no comments at the moment.