这题我开始就觉得花很多时间,最后几分钟写出来的 用的很蠢的string import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String in = sc.nextLine(); int left = 0; if(in.startsWith("-")){ left = 1; } int start = in.indexOf('.'); int len = start == -1 ? in.length() - 1 : start - 1; String res = "."; int count = 1; for(int i = len; i >= left; i--){ if(count == 3 && i != left){ res = "," + in.charAt(i) + res; count = 1; }else{ res = in.charAt(i) + res; count++; } }
点赞 6

相关推荐

自来熟的放鸽子能手面...:这个不一定,找hr跟进一下
点赞 评论 收藏
分享
牛客83265014...:完了,连现在都没开始面,13号投的是不是晚了
秋招的第一个offer,...
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务