题解 | #字符串分隔#

字符串分隔

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

#include <stdio.h>
#include <string.h>

int main() {
    char* string = (char*)malloc(sizeof(char) * 5000);
    while (scanf("%8s", string) != EOF) { // 注意 while 处理多个 case
        if(strlen(string)==0) continue;
        printf("%s", string);
        int total = 8 - strlen(string);
        for (int i = 0; i < total; i++) {
            printf("0");
        }
        printf("\n");
    }
    return 0;
}

全部评论

相关推荐

09-11 10:24
武汉大学 运营
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
08-08 18:20
职场水母:这题思路是什么,我目前想的一个暴力方法就是先把这个链表遍历一遍,用哈希表存储出现次数,然后再根据哈希表来一个一个删除节点,
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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