2 shunfurh shunfurh 于 2017.09.13 21:35 提问

Arne Saknussemm

Problem Description
Following the account of Jules Verne, a scrambled message written by the middle age alchemist Arne Saknussemm, and deciphered by professor Lidenbrock, started the incredible travel to the center of the Earth. The scrambling procedure used by Arne is alike the procedure given below.

  1. Take a non empty message M that contains letters from the English alphabet, digits, commas, dots, quotes (i.e. '), spaces and line breaks, and whose last character is different than space. For example, consider the following message whose translation reads "In Sneffels's crater descend brave traveler, and touch the center of the Earth".

In Sneffels craterem descende audasviator, et terrestre centrum attinges.

  1. Choose an integral number 0<K≤length(M) and add trailing spaces to M such that the length of the resulting message, say M', is the least multiple of K. For K=19 and the message above, where length(M)=74 (including the 8 spaces and the line break that M contains), two trailing spaces are added yielding the message M' with length(M')=76.

  2. Replace all the spaces from M' by the character _ (underscore) ; replace all the line breaks from M' by \ (backslash), and then reverse the message. In our case:

__.segnitta_murtnec_ertserret_te_,rotaiv\sadua_ednecsed_meretarc_sleffenS_nI

  1. Write the message that results from step 3 in a table with length(M')/K rows and K columns. The writing is column wise. For the given example, the message is written in a table with 76/19=4 rows and 19 columns as follows:
    [缺少图片]

  2. The strings of characters that correspond to the rows of the table are the fragments of the scrambled message. The 4 fragments of Arne's message given in step 1 are:

etmneet_t\udsmt_fS.narctrtria_edrrlen
_gtuerr
,asaneeasf_si_t_seeovdec_ecenI

Write a program that deciphers non empty messages scrambled as described. The length of a message, before scrambling, is at most 1000 characters, including spaces and line breaks.

Input
The program input is from a text file where each data set corresponds to a scrambled message. A data set starts with an integer n, that shows the number of fragments of the scrambled message, and continues with n strings of characters that designate the fragments, in the order they appear in the table from step 4 of the scrambling procedure. Input data are separated by white-spaces and terminate with an end of file.

Output
The deciphered message must be printed on the standard output, from the beginning of a line and must be followed by an empty line as shown in the input/output sample below.

Sample Input
4 etmneet_t\udsmt_fS
_gtuerr
,asaneeasf_
.narctrtria_edrrlen
si_t_seeovdec_ecenI
11 e n r e V _ s e l u J

Sample Output
In Sneffels craterem descende audas
viator, et terrestre centrum attinges.

Jules Verne

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.29 23:56
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
Arne Saknussemm
Description Following the account of Jules Verne, a scrambled message written by the middle age alchemist Arne Saknussemm, and deciphered by professor Lidenbrock, started the incredible travel to t
zoj 3121 Arne Saknussemm
<br />乍一看挺郁闷的。。这么长的题。后来好好看看题,好像不太难,好多题都是可以根据样例输入输出来判断题的。。。这道也是。。<br /> <br />从输入的序列右下角开始往上逆序输出,即a[n][n].....a[0][n]  a[n][n-1]...a[0][n-1]一直这样。。。感觉成就感的是没有PE,一次AC,嘻嘻~<br /> <br /> <br />#include <stdio.h> #include <stdlib.h> #include <string.h> int main(
ZOJ3121 POJ3488 Arne Saknussemm
挺简单的模拟题,直接给代码吧/******************************************************************************* * Author : Neo Fung * Email : neosfung@gmai
HDU 1915 Arne Saknussemm
 http://acm.hdu.edu.cn/showproblem.php?pid=1915 题目大意:又是一题破译密码的问题啦,这道题就是"_"代表空格,"/"代表是换行,字符串最后一行末尾的空格不要输出,要不然就PE,输出结果就是了。 解题思路:很水的一题,自己看代码吧. #include #include using namespace std;
ZOJ 3121 Arne Saknussemm
<br /> <br />典型的英文题,读不懂题不知道他要干什么,它那种复杂的字符串变形绝对是用来难为人的,我简单说一下意思吧:<br /> <br /> <br />给定一个字符串,再给定一个K值,K小于字符串长度,在字符串末尾添加空格使,长度为K的整数倍,然后使串中空格替换为'_',让换行替换为'//',注意这里是双斜杠,然后让整个字符串翻转,不急,还没完,然后把字符串放到长度为K,宽度为长度除以k,地表格中,题目给出转换过后 的几个字符串,你需要把它们还原成转换之前形式,不难,就是繁.<br /> <
POJ 3488 Arne Saknussemm 可能会
-
HDU 1915 Arne Saknussemm (解题报告)
Problem DescriptionFollowing the account of Jules Verne, a scrambled message written by the middle age alchemist Arne Saknussemm, and deciphered by professor Lidenbrock, started the incredible trave
poj 3488 Arne Saknussemm 模拟题
今天听了鑫固的理解,直接将这道题搞定了。 题目是英文题,那叫一个长啊,读着读着就不想读了,后来鑫固提醒直接看样例,然后就解决掉了,下附题目链接。 题目链接 直接从最后一列,往前一列一列的输出就可以了,列输出的顺序是从下往上输出。然后遇到“\”输出回车,遇到“_” 输出空格就ok了。 下面附上切题代码 #include #include #include char a[1100][1100]
POJ - 3488 Arne Saknussemm(水题,细节题)
Arne Saknussemm Time Limit: 1000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Submit Status Description Following the account of Jules Verne, a scrambled
POJ 3488 Arne Saknussemm 字符串译码
把字符串从下至上,从右至左写,同时空格变成'_'.回车变成'\',.翻译的话反过来就行了,注意去掉尾部的空格..不知道为什么,字符数组开在循环内部,但是每次不初始化就出错...#include #include using namespace std; int main(){