sicily 1007. To and Fro

#include<iostream>
#include
<stdio.h>
using namespace std;
int main()
{
int column,row,length,i,time;
char ch,list[100][20];

while(scanf("%d",&column),column)
{
scanf(
"\n");
length
=i=0;
while(scanf("%c",&ch),ch!='\n')
{
length
++;
list[(length
-1)/column][i++]=ch;
i
=i%column;
}
row
=length/column;
for(time=0;time<column;time++)
for(i=0;i<row;i++)
if(i%2)
cout
<<list[i][column-time-1];
else
cout
<<list[i][time];
printf(
"\n");
}
return 0;
}

posted on 2011-07-04 18:33  sysu_mjc  阅读(185)  评论(0编辑  收藏  举报

导航