#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; }
HDU 1200 || ZOJ 2208 To and Fro
最新推荐文章于 2019-04-09 12:22:12 发布