NYOJ题目1080年龄排序
--------------------------
桶排都过不了,我彻底没办法了...
1 import java.io.BufferedReader; 2 import java.io.IOException; 3 import java.io.InputStreamReader; 4 5 public class Main{ 6 7 public static void main(String[] args) throws NumberFormatException, IOException { 8 9 BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); 10 11 int n=Integer.parseInt(reader.readLine()); 12 int book[]=new int[151]; 13 String ss[]=reader.readLine().split(" "); 14 for(int i=0;i<n;i++) book[Integer.parseInt(ss[i])]++; 15 16 StringBuilder sb=new StringBuilder(); 17 for(int i=0;i<book.length;i++){ 18 while(book[i]-->0) sb.append(i).append(" "); 19 } 20 21 System.out.println(sb.toString()); 22 } 23 24 }