http://acm.hdu.edu.cn/showproblem.php?pid=1200
分析:题目比较简单,就不多说(这里用了最笨的一种方法,表示比较好理解)
代码:
//hdu 1200
#include <iostream>
#include <cstdio>
#include <string.h>
#include <string>
using namespace std;
char a[24][24];
int main()
{
freopen("in.txt","r",stdin);
int n;
int row;
string str;
while(scanf("%d",&n)!=EOF){
if(n==0) break;
getchar();
cin>>str;
row=0;
for(int i=0;i<str.length();){
if(row&1){
for(int cnt=n-1;cnt>=0;cnt--)
a[row][cnt]=str[i++];
}
else{
for(int cnt=0;cnt<n;cnt++)
a[row][cnt]=str[i++];
}
row++;
}
for(int j=0;j<n;j++)
for(int i=0;i<(str.length()/n);i++)
printf("%c",a[i][j]);
printf("\n");
}
}
解析HDU在线评测系统中的1200号题
本文详细分析了HDU在线评测系统中编号为1200的问题,提供了一种易于理解的解决方法,并附上了相应的代码实现。适合初学者和希望提高算法思维能力的读者。
497

被折叠的 条评论
为什么被折叠?



