2012-01-18 15:47:51Morris
[JAVA] a104. 排序
import java.util.Scanner;
import java.util.Arrays;
public class a104 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n, i;
int arr[] = new int[1000];
while(in.hasNext()) {
n = in.nextInt();
for(i = 0; i < n; i++)
arr[i] = in.nextInt();
Arrays.sort(arr, 0, n);
for(i = 0; i < n; i++)
System.out.print(arr[i] + " ");
System.out.println();
}
}
}
import java.util.Arrays;
public class a104 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n, i;
int arr[] = new int[1000];
while(in.hasNext()) {
n = in.nextInt();
for(i = 0; i < n; i++)
arr[i] = in.nextInt();
Arrays.sort(arr, 0, n);
for(i = 0; i < n; i++)
System.out.print(arr[i] + " ");
System.out.println();
}
}
}