public class Main { public static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException{ char[] cs = reader.readLine().toCharArray(); for (int i = 0; i < cs.length; i++) { char min = cs[i]; int minIndex = i; for (int j = i + 1; j < cs.length; j++) { if (cs[j] < min) { min = cs[j]; minIndex = j; } } if (minIndex != i) { char temp = cs[i]; cs[i] = cs[minIndex]; cs[minIndex] = temp; break; } } System.out.println(new String(cs)); } } 为啥只能过 26%的用例
点赞 2

相关推荐

查看21道真题和解析
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务