Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
高人常在,搜到了一个十分简洁的代码,太牛了#include "stdio.h" #include "string.h" int main() { char str[1000]; int i,j,len; int N; while(1) { scanf("%d",&N); if(N==0) break; scanf("%s",str); len=strlen(str); for(i=0;i<N;i++) { for(j=0;j<len/N;j++) { if(j%2==0) putchar(str[i+N*j]); else putchar(str[N-1-i+N*j]); } } putchar('\n'); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator