题解 | #字符串排序#

字符串排序

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

import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int M = Integer.parseInt(in.readLine()); int[] m = new int[M]; int i = 0; String str = null; // ArrayList arr = new ArrayList<>(); while((str = in.readLine())!= null){ m[i++] = Integer.valueOf(str.substring(str.length() - 6)) ; // String[] s = str.split(" "); // for(String temp : s){ // arr.add(Integer.valueOf(temp.substring(temp.length() - 6))); // // int len = temp.length(); // // char[] ch = new char[6]; // // for(int i = 5;i >= 0;i--){ // // ch[i] = temp.charAt(--len); // // } // // String st = new String // // arr.add(Integer.parseInt(ch)); // }

    }
   
    Arrays.sort(m);
    for(int t:m){
        System.out.println(t);
    }
}

}

全部评论

相关推荐

06-23 11:43
门头沟学院 Java
allin校招的烤冷面很爱看电影:我靠,今天中午我也是这个hr隔一个星期发消息给我。问的问题还是一模一样的😅
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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