您的位置:首页 > 其它

ZOJ 3121 Arne Saknussemm

2013-05-30 10:55 176 查看
字符串解密水题.

最后一列注意一下就可以.

#include <iostream>
#include <cstdio>
#include <string.h>
#include <memory.h>
using namespace std;

const int maxn = 1010;
char str[maxn];
int n;

int main(){
while(~scanf("%d", &n)){
scanf("%s",str);
int k = strlen(str);
for(int i = 1; i < n; ++i){
scanf("%s", &str[i * k]);
}
int row = strlen(str) / k;
for(int i = k - 1; i >= 0; --i){
int tmp = 0;
if(i == 0){
for(; tmp < k && str[tmp] == '_'; ++tmp);
}
for(int j = n - 1; j >= tmp; --j){
char & ch = str[j * k + i];
if(ch == '_'){
printf(" ");
}else if(ch == '\\'){
printf("\n");
}else{
printf("%c", ch);
}
}
}
printf("\n\n");
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: