A1348 | [COCI-2016_2017-contest4]#2 Kartomat
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
A ticket machine is a device similar to an ATM and was introduced by Croatian Railways in order to make purchasing train tickets easier. The first step in buying a ticket is choosing the destination of your journey. The destination can be one of N destinations offered in advance, names of local and worldwide places. You choose your destination by typing its name letter by letter. By entering each additional letter, the number of possible destinations reduces.
The initial appearance of the keyboard on the screen is shown in the picture. We will represent it as four arrays of characters of length
8.
After choosing each letter, the keyboard changes its appearance. Only letters that can be chosen in the next step are left active (depending on the destinations still possible to choose). The remaining letter that can’t be chosen are replaced with the character "*".
Write a programme that will, for N given destinations and the first few letters (not all of them)
of the chosen destination, output the appearance of the keyboard before entering the next letter. You will never be given the entire word.
The initial appearance of the keyboard on the screen is shown in the picture. We will represent it as four arrays of characters of length
8.
After choosing each letter, the keyboard changes its appearance. Only letters that can be chosen in the next step are left active (depending on the destinations still possible to choose). The remaining letter that can’t be chosen are replaced with the character "*".
Write a programme that will, for N given destinations and the first few letters (not all of them)
of the chosen destination, output the appearance of the keyboard before entering the next letter. You will never be given the entire word.
输入格式
The first line contains the integer N (1 ≤ N ≤ 50) from the task. Each of the following N lines contains one string of at most 100 characters that contains only uppercase letters of the English alphabet. The last line contains the string that represents the first few letters of the chosen destination.
输出格式
You must output the appearance of the keyboard described in the task.
输入输出样例
输入 #1
4 ZAGREB SISAK ZADAR ZABOK ZA
输出 #1
****B*D* *G****** ******** ********
输入 #2
4 SPLIT VINKOVCI NOVSKA RIJEKA VINKO
输出 #2
******** ******** ******** V*******
输入 #3
4 AAAABCD AAAABCA AAAACDE AAAAAAA AAAA
输出 #3
***ABC** ******** ******** ********
Clarification of the first test case:
After entering the letters "ZA", the third letter can be "G" if we want a ticket to Zagreb, "D" if we want a
ticket to Zadar, and "B" if we want a ticket to Zabok.
After entering the letters "ZA", the third letter can be "G" if we want a ticket to Zagreb, "D" if we want a
ticket to Zadar, and "B" if we want a ticket to Zabok.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted