Fork me on GitHub

NYOJ之ASCII码排序


-------------------------------------------------------------

AC代码:

 1 import java.util.Arrays;
 2 import java.util.Scanner;
 3 
 4 public class Main {
 5 
 6     public static void main(String[] args) {
 7         
 8         Scanner sc=new Scanner(System.in);
 9         
10         int n=Integer.parseInt(sc.nextLine());
11         
12         while(n-->0){
13             
14             String s=sc.nextLine();
15 
16             char[] book=s.toCharArray();
17             Arrays.sort(book);
18             
19             for(int i=0;i<book.length;i++){
20                 System.out.printf("%c ",book[i]);
21             }
22             System.out.println();
23         }
24         
25     }
26     
27 }

 

题目来源:http://acm.nyist.net/JudgeOnline/problem.php?pid=4

posted @ 2016-08-20 20:33  CC11001100  阅读(178)  评论(0编辑  收藏  举报