类型:
方法一:第一行输入二维数组的个数
第二行输入第一维的个数
第三行输入第一维的元素
第四行输入第一维的个数
第五行输入第一维的元素
Scanner sc=new Scanner(System.in); int numCount=sc.nextInt(); int[][] numArrs=new int[numCount][]; for(int i=0;i<numCount;i++){ int l=sc.nextInt(); numArrs[i]=new int[l]; for(int j=0;j<l;j++){ numArrs[i][j]=sc.nextInt(); }
输出格式:
2
3
1 2 3
4
1 2 3 4
方法二:
Scanner input=new Scanner(System.in); int n=input.nextInt(); while(n!=0){ int t=input.nextInt(); for(int i=0;i<t;i++){ int a=input.nextInt(); } n--; }
输出格式:
2
3
1 2 3
4
1 2 3 4