题解 | #字符串分隔#

字符串分隔

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

#include<stdio.h>
#include<string.h>
int main()
{
   char str[100];
   while(scanf("%8s",str)!=EOF)
   {
    int len = 8-strlen(str);
    printf("%s", str);
    for(int i=0; i<len; i++)
    {
        printf("0");
    }
    printf("\n");
   }

   return 0;
}

思路要点:while(scanf("%8s",str)!=EOF)---不间断连续输入,每次缓存8个字符

全部评论

相关推荐

FieldMatching:看成了猪头顾问,不好意思
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务