题解 | 字符串分隔

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

int main() {
    string a;
    getline(cin, a);
    int n = 0 == a.length() % 8 ? 0 : 8 - a.length() % 8;
    for (int i=0; i<a.length() + n; i++) {
        i < a.length() ? cout << a[i] : cout << '0';
        if (0 == (i+1)%8) {
            cout << endl;
        }
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

做个有文化的流氓:不想当将军的士兵不是好士兵
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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