Agent's Decoder
Submit solution
Points:
10 (partial)
Time limit:
1.0s
Memory limit:
64M
Authors:
Problem type
Allowed languages
Java 19, Java 8
題目描述
特務 J 收到了一份加密的機密文件,裡面包含兩個部分:
- 一個密碼本字串(Codebook),用來解密。
- 一串加密數字(Cipher),這些數字表示密碼本中對應字母的位置。
解密的規則:
- 密碼本 A 是一個字串。
- 加密數字 B 是一個整數陣列,每個數字代表密碼本 A 中對應字母的索引。
輸入:
- 第一行是字串 A,即密碼本。
- 第二行是一個整數 n,表示加密數字陣列 B 的長度。
- 接下來的 n 行,每行輸入一個整數,表示加密數字 B 中的元素,這些數字是 A 字串中的有效索引。
輸出:
- 輸出一個解密後的字串。根據加密數字 B 中的索引,從字串 A 中提取對應的字母,組成最終的解密訊息。
範例
sample input1
hello world
5
0 1 2 3 4sample output1
hellosample input2
programming
6
0 2 4 4 2 0sample output2
porrop
Comments