QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓

#14070. 密码解密

Estadísticas

来自库巴军队的间谍。

碧姬公主正试图组织蘑菇王国的军队来抵御库巴的进攻。然而,她的命令不断被库巴的顶级间谍 L 先生截获。碧姬公主尝试了多种加密方法,但 L 先生都聪明地破解了所有的尝试。不过,碧姬公主的情报部门刚刚发现,L 先生居然不会做乘法!于是他们迅速设计了一种密码来利用这一弱点。

MKIA(蘑菇王国情报局)设计了以下数字到字符的映射:$0 - 25$ 对应 $A - Z$,并且这个模式无限循环:$26 - 51$ 对应 $A - Z$,$52 - 77$ 对应 $A - Z$,依此类推。MKIA 首先选择一个秘密的数字序列 $s_1 s_2 \dots s_l$。给定这个秘密数字字符串,MKIA 可以按如下方式加密消息:

  1. 对于消息中的每个字符,使用 MKIA 映射找到其对应的数字。
  2. 将该数字与秘密数字字符串中对应位置的数字相乘。
  3. 使用 MKIA 映射将此结果转换回字符,作为加密后的结果。

给定一个数字字符串和一系列消息,请返回应用上述算法加密后的消息。

输入格式

第一行是一个数字序列,表示每个位置上的乘数。其长度为 $l$,其中 $1 \le l \le 100$。

第二行表示测试用例的数量 $n$。$1 \le n \le 1000$。

接下来的 $n$ 行是要加密的消息。这些消息保证长度为 $l$。

输出格式

输出 $n$ 行,包含加密后的字符串。

样例

输入样例 1

17247
2
HELLO
WORLD

输出样例 1

HCWSU
WUISV

输入样例 2

010281
3
THANKS
TOJANE
STREET

输出样例 2

AHAACS
AOAAAE
ATAIGT

输入样例 3

0102
8
ONEF
ISHT
WOFI
SHRE
DFIS
HBLU
EFIS
HHHH

输出样例 3

ANAK
ASAM
AOAQ
AHAI
AFAK
ABAO
AFAK
AHAO

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.