解题思路
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sin = new Scanner(System.in);
int n = sin.nextInt();
int m = sin.nextInt();
int[] nm = new int[n*m];
int i = 0;
while(sin.hasNext()){
nm[i++] = sin.nextInt();
}
int t = 0;
for(int in =0;in<n;in++){
for(int im = 0;im<m;im++){
System.out.print(nm[t++] + " ");
}
System.out.println(" ");
}
}
}