解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();//n行
int m = scanner.nextInt();//m列
int[][] B = new int[m][n];
//A矩阵
int[][] A = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
A[i][j] = scanner.nextInt();
}
}
//B矩阵
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
B[i][j] += A[n - 1 - j][i];
}
}
//输出B矩阵
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
System.out.print(B[i][j] + " ");
}
System.out.println();
}
}
}
0.0分
0 人评分