2 人解决,6 人已尝试。
2 份提交通过,共有 11 份提交。
9.4 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
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.
In Sneffels craterem descende audas
viator, et terrestre centrum attinges.
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.
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
etmneet_t\udsmt_fS _gtuerr,asaneeasf_
.narctrtria_edrrlen 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.
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.
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.
4 _etmneet_t\udsmt_fS _gtuerr_,asaneeasf_ .narctrtria_edrrlen si_t_seeovdec_ecenI 11 e n r e V _ s e l u J
In Sneffels craterem descende audas viator, et terrestre centrum attinges. Jules Verne
2 人解决,6 人已尝试。
2 份提交通过,共有 11 份提交。
9.4 EMB 奖励。
创建: 17 年前.
修改: 7 年,2 月前.
最后提交: 1 年,4 月前.