题目1041:Simple Sorting
参考代码:
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String arg[]){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int num = sc.nextInt();
ArrayList<Integer> count = new ArrayList<Integer>();
for(int i=0;i<num;i++){
Integer newnum = sc.nextInt();
if(count.contains(newnum)==false) count.add(newnum);
}
Collections.sort(count);
System.out.println(count.toString()
.replace("[","")
.replace("]", "")
.replace(",", ""));
}
}
}