题解 | #序列重组矩阵#
序列重组矩阵
http://www.nowcoder.com/practice/7548f8f5e44c42fa84fb2323d899a966
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int m = scan.nextInt();
int[] arr = new int[n * m + 1];
for (int i = 1; i < arr.length; i++) {
arr[i] = scan.nextInt();
}
for (int i = 1; i < arr.length; i++) {
if (i % m == 0) {
System.out.println(arr[i]);
} else {
System.out.print(arr[i] + " ");
}
}
}
}
Java基础练习题 文章被收录于专栏
都是一些基础的语法题目,每天可以刷几道。