Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

高人常在,搜到了一个十分简洁的代码,太牛了

Posted by finalhope at 2013-03-31 09:59:29 on Problem 2039
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator