pat a1031(简单模拟)

    技术2024-10-28  20

    代码:

    # include<stdio.h> # include<string.h> int main(){ char s[100]; scanf("%s",&s); int l=strlen(s); int a=(l+2)/3; int b=l-2*a+2; int i,j; for(i=0;i<a-1;i++){ printf("%c",s[i]); for(j=0;j<(b-2);j++) printf(" "); printf("%c\n",s[l-i-1]); } for(i=0;i<b;i++) printf("%c",s[i+a-1]); }
    Processed: 0.012, SQL: 9