不多说上需求 上代码
import java.util.Scanner;
class Main
{
public static void main()
{
Scanner input = new Scanner(System.in);
int M, N, T;
M = input.nextInt();
N = input.nextInt();
T = input.nextInt();
int[][] arr;
if ((M > 0 && M < 200) && (N > 0 && N < 200) && (T >= 0 && T <= 1))
{
arr = new int[M][N];
for (int i = 0; i < M; i++)
{
for (int j = 0; j < N; j++)
{
arr[i][j] = input.nextInt();
}
}
// 左右翻转
if (T == 0)
{
for (int i = 0; i < M; i++)
{
for (int j = 0; j < N; j++)
{
System.out.print(arr[i][N - 1 - j] + " ");
}
System.out.println();
}
}
// 上下翻转
else
{
for (int i = 0; i < M; i++)
{
for (int j = 0; j < N; j++)
{
System.out.print(arr[M - i - 1][j] + " ");
}
System.out.println();
}
}
}
}
}