luogu#P5000. Hillwer编码
Hillwer编码
Background
In the high-tech research center of Country Z, researchers use the most “advanced” Hillwer encoding (after all, this is the national secret vault, storing the most important confidential information~~QwQ).
Problem Description
Country Z is very technologically advanced and has always been a target coveted by other countries, and Country Y is one of them. After Country Y’s hackers worked day and night, they finally obtained the conversion method of Country Z’s Hillwer encoding and intercepted plaintext strings. BUT (there are always so many “buts”~), after studying Hillwer with all their effort, the hackers of Country Y were exhausted… so they cannot finish the task of converting Hillwer encoding.
The leader of Country Y heard that in a faraway eastern land, there is a group of talented teenagers—yes, you who are sitting in front of the computer! The leader hopes you can help Country Y convert the encoding, and he will reward you with the NOIP_AK Glory Laurel Crown!
The conversion rules of Hillwer encoding are as follows: For each plaintext string , it is guaranteed to consist only of uppercase letters. Shift each letter backward by positions to get the intermediate string (when =XYZ, , then =ZAB. That is, change it to the -th letter after the current one; if it goes past Z, start again from A). Next, perform the “symbol-to-number” operation on the intermediate string: multiply the ASCII codes of each character in to obtain the number string . The converted encoding is .
To check whether you are slacking off, the leader also requires you to output the intermediate string .
Input Format
Line : read in .
Lines to : each line contains one encoding .
Output Format
There are lines in total:
-
Odd-numbered lines: one intermediate string per line.
-
Even-numbered lines: one converted encoding per line.
2 6
HELLOWORLD
LETUSGO
NKRRUCUXRJ
10167740864629920000
RKZAYMU
20957073637500
Hint
For of the testdata, , .
For of the testdata, , .
For of the testdata, , , and the plaintext length is less than .
Translated by ChatGPT 5