题解 | #字符串分隔#

字符串分隔

http://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        if(str.length()%8 != 0){
            str = str+"00000000";
        }
        for(int i = 0;i<str.length()/8;i++){
            int index = i* 8;
            System.out.println(str.substring(index,index+8));
        }
    }
}
全部评论
女少
点赞 回复 分享
发布于 2022-07-24 17:21
简单粗暴,牛逼
点赞 回复 分享
发布于 2022-07-24 17:18
直接添加8个0嘛。。。我还是太乖了
点赞 回复 分享
发布于 2022-04-23 15:51

相关推荐

大野鸡:其实就是量,但是时间有限,1000题只要不是全中等简单,简单中等困难1-2-1,大概能打打比赛了(前20%),10000题就是下一个灵神
点赞 评论 收藏
分享
评论
15
2
分享

创作者周榜

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