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 Acaini at 2009-07-16 23:32:14 on Problem 2039
#include<iostream>
using namespace std;
char s[201];
int main()
{
	int row,col,len,i,j,k;
	while(scanf("%d",&col)==1 && col!=0)
	{
		scanf(" %s",&s);
		len=strlen(s);
		row=len/col;
		for(i=0;i<col;i++)
			for(j=0,k=-i-1;j<row;j++)
			{
				if(j%2==0) k+=2*i+1; 
				else k+=2*(col-i)-1;
				printf("%c",s[k]);
			}
		printf("\n");
	}
	return 0;
}

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