This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scn = new Scanner(System.in); | |
while(scn.hasNext()){ | |
int x=scn.nextInt(),y=scn.nextInt(),arr[][]=new int[y][x]; | |
for(int i=0;i<x;i++) | |
for(int j=0;j<y;j++) | |
arr[j][i]=scn.nextInt(); | |
for(int i=0;i<y;i++){ | |
for(int j=0;j<x;j++){ | |
if(j!=0) | |
System.out.print(" "); | |
System.out.print(arr[i][j]); | |
} | |
System.out.println(); | |
} | |
} | |
} | |
/*題目:[C_MM246-易] 矩陣反轉 | |
作者:1010 | |
時間:西元 2017 年 4 月 */ | |
} |
這題矩陣反轉就是建立二維陣列下去實作,輸入時索引值顛倒
沒有留言:
張貼留言