HDU 1200 || ZOJ 2208 To and Fro

来源:互联网 发布:python硬件编程 编辑:程序博客网 时间:2024/06/05 09:59
#include<stdio.h>#include<string.h>int main(){    int i,j,len,c,row;    char s[200],str[200][200];    while(scanf("%d",&c)!=EOF && c){        scanf("%s",s);        len=strlen(s);        row=len/c;        for(i=0;i<row;i++){           for(j=0;j<c;j++){              if(i%2==0)  str[i][j]=s[i*c+j];              else str[i][c-j-1]=s[i*c+j];             }           }        for(j=0;j<c;j++)           for(i=0;i<row;i++)              printf("%c",str[i][j]);         printf("\n");    }    return 0;    }
原创粉丝点击