题目:
样例输入:
5
7 58 55 88 74 95 98 86
3 90 65 78
2 70 58
5 17 62 69 83 32
9 51 66 42 98 13 85 87 97 60
样例输出:
17 62 69 83 32
70 58
51 66 42 98 13 85 87 97 60
90 65 78
58 55 88 74 95 98 86
问题:不知道如何按照平均成绩的大小输出输入的数据
package test;
import java.util.Arrays;
import java.util.Scanner;
public class Jiaoxue {
public void main (String [] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[][] a =new int [n][];
int[] sum = new int [n];
int[] average = new int [n];
for(int i = 0;i<n;i++) {
for(int j=0 ;j<a[i][0];j++) {
a[i][j] =sc.nextInt();
}
}
for(int i=0;i<n;i++) {
for(int j=1;j<a[i][0];j++)
{
sum[i]=sum[i]+a[i][j];
}
average[i]=sum[i]/a[i][0];
}
}
}