题解 | #字符串排序#

字符串排序

http://www.nowcoder.com/practice/0425aa0df74646209d3f56f627298ab2

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()) {
            int M = sc.nextInt();
            int[] arr = new int[M];
            for(int i = 0; i < M; i++) {
                String s = sc.next();
                int len = s.length();
                arr[i] = Integer.parseInt(
                    s.substring(len - 6, len)
                );
            }
            Arrays.sort(arr);
            for(int i = 0; i < M; i++) {
                System.out.println(arr[i]);
            }
        }
    }
}
全部评论

相关推荐

06-26 15:35
武汉大学 运营
点赞 评论 收藏
分享
那一天的Java_Java起来:他本来公司就是做这个的,不就是正常的游戏客户端和服务器开发,软硬件联动,有啥恶心不恶心的,提前告诉你就是怕你接受不了,接受不了就没必要再往后走流程浪费时间,虽然这公司是一坨。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务