QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 32 MB 總分: 70

#17050. 无聊的

统计

Mirko 收到了一封来自他的朋友 Slavko 的邮件。Slavko 是一位世界级的密码学家,他喜欢对他发给 Mirko 的消息进行加密。这一次,他决定使用一次性密码本(One Time Pad, OTP)加密。如果使用得当,OTP 是无法破译的,Slavko 也深知这一点。然而,他不想让 Mirko 因为面对一个不可能完成的任务而苦恼,因此他在消息中附带了一些提示。

Mirko 知道 Slavko 的原始明文包含英文小写字母('a' - 'z')、句点 '.' 和空格 ' '(ASCII $32_{10}$)。此外,他知道 Slavko 仅使用数字 '0''9' 作为密钥。经过深思熟虑,他意识到自己可以确定明文中所有空格和句点的位置。现在,他请求你编写一个程序来自动完成这项工作。

根据以往与 Slavko 打交道的经验,Mirko 知道 OTP 加密是如何工作的。让我们来看一个简单的例子。假设你想使用 "0120123" 作为密钥来对字符串 "abc efg" 进行加密。

abc efg 61 62 63 20 65 66 67 51 53 51 10 54 54 54
0120123 30 31 32 30 31 32 33
初始 ASCII 十六进制 加密消息

首先,使用 ASCII 编码将密钥和明文都转换为十六进制数。然后将它们对齐,并对每对进行异或(XOR)操作。得到的序列就是加密后的消息。

输入格式

输入的第一行包含一个整数 $N$ ($1 \le N \le 1000$),表示加密消息中的字符数。

下一行包含 $N$ 个用十六进制表示的整数,其值大于或等于 $0_{10}$ 且小于或等于 $127_{10}$,表示加密后的消息。

输出格式

输出的第一行也是唯一一行应包含 $N$ 个字符,每个字符代表明文中的一个字符。如果明文的第 $i$ 个字符是字母,则输出的第 $i$ 个字符应为破折号 -;如果不是,则应输出句点 .

样例

输入样例 1

7
51 53 51 10 54 54 54

输出样例 1

---.---

输入样例 2

7
53 53 51 54 54 51 10

输出样例 2

------.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.