题解 | #字符串分隔#

字符串分隔

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

初始化补位列,减少循环补位时间。

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}
class HelloWorld {
    import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        if(null != str&&!str.trim().equals("")){
            String m = "00000000";
            int c = str.length()%8;
            if(c != 0){
                str = str+m.substring(c);
            }
            for(int i=0;i<str.length();i = i+8){
                System.out.println(str.substring(i,i+8));
            }
        }
            
    }
}
}
print('Hello world!')
全部评论

相关推荐

身边有人上海、深圳&nbsp;6、7k&nbsp;都去了,真就带薪上班了。
程序员小白条:木的办法, 以后越来越差,还是家附近宅着吧,毕业的人越来越多,岗位都提供不出来,经济又过了人口红利期
点赞 评论 收藏
分享
陆续:不可思议 竟然没那就话 那就我来吧 :你是我在牛客见到的最美的女孩
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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