题解 | #字符串分隔#

字符串分隔

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

没什么好说的,先补0,再输出。

#include <string>
#include <vector>
#include <iostream>
using namespace std;

int main() {
    string s;
    cin >> s;
    int remind = s.length() % 8;
    if (remind) {
        s.append(8-remind, '0');
    }
    for (int i = 0; i < s.length(); i += 8) {
        cout << s.substr(i, 8) << endl;
    }
}
#笔试刷题#
全部评论

相关推荐

07-02 13:52
武汉大学 golang
骗你的不露头也秒
牛客87776816...:😃查看图片
点赞 评论 收藏
分享
每晚夜里独自颤抖:这个在牛客不是老熟人了吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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