标签:水题
【题目简述】:字符串的简单处理,看懂题意,特别是他给的那个例子就好,很简单
见代码:
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; char str[211][211]; int main() { int colum; char str1[211]; int tmp; while(cin>>colum,colum) { cin>>str1; int len = strlen(str1); tmp = len/colum; int count = 0; for(int i = 0;i<tmp;i++) { if(i%2 == 0) for(int j = 0;j<colum;j++) str[i][j] = str1[count++]; else for(int j = colum-1;j>=0;j--) str[i][j] = str1[count++]; } for(int i = 0;i<colum;i++) { for(int j = 0;j<tmp;j++) cout<<str[j][i]; } cout<<endl; } return 0; }
标签:水题
原文地址:http://blog.csdn.net/u013749862/article/details/39011423