input:
4
22 96 12 49
output:
2 4 1 3
我在輸出中想要的是根據輸入的學生排名。如何根據學生的排名打印數字
但是我現在想直到現在出錯了。
int count=0;
Scanner sc =new Scanner(System.in);
System.out.println("enter a number");
int a =sc.nextInt();
long[] b=new long[a];
for (int i = 0; i < a; i++) {
b[i]=sc.nextLong();
}
Arrays.sort(b);
for (int j = a-1; j >= 0; j--) {
System.out.println(b[j]);
count++;
System.out.println(count);
}
's []'在哪裏? –
's []'應該是'b []',我認爲它是一個錯字。 –