题解 | #序列重组矩阵#
序列重组矩阵
http://www.nowcoder.com/practice/7548f8f5e44c42fa84fb2323d899a966
解题思路
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(" ");
}
}
}