题解 | #Hello World for U#

Hello World for U

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

#include <stdio.h>
#include<math.h>
#include<string.h>
int main() {
    char a[80];
    while (scanf("%s",a) != EOF) {
        int m1 = (strlen(a)-1) / 3;
        int m2 = strlen(a) - (m1 * 2);
        for (int i = 0; i < m1; i++) {
            printf("%c", a[i]);
            for(int j=0;j<m2-2;j++)
            {
                printf(" ");
            }
            printf("%c\n", a[strlen(a) - 1 - i]);
        }
        for (int j = 0; j < m2; j++) {
            printf("%c",a[m1+j]);
        }
        printf("\n");
    }



    return 0;
}

全部评论

相关推荐

移动云能力 苏小妍 总包多3w左右
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务