AcWing 3174. 旋转[Java]
原题链接
简单
作者:
情意
,
2021-03-21 11:16:18
,
所有人可见
,
阅读 285
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] s = br.readLine().split(" ");
int m = Integer.parseInt(s[0]);
int n = Integer.parseInt(s[1]);
int [][] arr = new int[m][n];
for (int i = 0; i < m; i++) {
String[] s1 = br.readLine().split(" ");
int t =0;
while (t<n){
arr[i][t] = Integer.parseInt(s1[t++]);
}
}
for(int i = 0;i<n;i++){
for(int j = m-1;j>=0;j--){
System.out.print(arr[j][i]+" ");
}
System.out.println();
}
}
}