題目: 排序
import java.util.Scanner;
import java.util.Arrays;
public class Sort{
public static Scanner sc = new Scanner(System.in);
public static int length,i;
public static int[] a;
public static void main(String args[]){
while(sc.hasNext()){
length = sc.nextInt();
a = new int[length];
for(i = 0; i < length; i++){
a[i] = sc.nextInt();
}
Arrays.sort(a);
for(i = 0; i < length; i++){
System.out.print(a[i] + " ");
}
System.out.println();
}
}
}
沒有留言:
張貼留言