标签:include cout pac sage ios names main string amp
#include<iostream>
#include<string>
#include<string.h>
using namespace std;
char message[20][200];
int main()
{
string msg;
int col;
while(cin>>col&&col!=0)
{
cin>>msg;
int line=(msg.size()+1)/col;
for(string ::size_type i=0;i<msg.size();i++)
{
int hang=i/col;
int lie;
hang%2==0?lie=i%col:lie=col-1-i%col;
message[hang][lie]=msg[i];
}//end for
for(int j=0;j<col;j++)
{
for(int i=0;i<line;i++) cout<<message[i][j];
}//end for
cout<<endl;
}//end while
}
[sicily online]1007. To and Fro
标签:include cout pac sage ios names main string amp
原文地址:http://www.cnblogs.com/sysu-eeman-yang/p/5987373.html