2.9 号英语翻译

题目来源:http://noi.openjudge.cn/ch0205/1159/

重点词汇:

maze : n.迷宫;

multiple : n .倍速, adj.多种的;

denote : v.表示;

layout : n.布局;

terminate : adj.临界的;

1159:Maze

      迷宫

总时间限制: 
2000ms
 
内存限制: 
65536kB
描述
Acm, a treasure-explorer, is exploring again. This time he is in a special maze, in which there are some doors (at most 5 doors, represented by 'A', 'B', 'C', 'D', 'E' respectively). In order to find the treasure, Acm may need to open doors. However, to open a door he needs to find all the door's keys (at least one) in the maze first. For example, if there are 3 keys of Door A, to open the door he should find all the 3 keys first (that's three 'a's which denote the keys of 'A' in the maze). Now make a program to tell Acm whether he can find the treasure or not. Notice that Acm can only go up, down, left and right in the maze.
寻宝者 Acm 再次开始探险。这一次他在一个迷宫里,这里有一些门(最多5个门,分别用'A'  'B'  'C'  'D'  'E'  表示)。为了找到宝藏,Acm 可能需要去开门。然而,要打开一扇门,他首先需要在迷宫中找到所有门的钥匙(至少一把)。例如,如果门 A有三把钥匙,要打开这扇门则首先应该找出全部的3把钥匙(即迷宫中三把 'a' 表示 'A' 的钥匙)。现在编写一个程序用来告诉Acm 他是否可以找到宝藏。注意 Acm 在迷宫中只能向上,向下,向左,向右移动。 
输入
The input consists of multiple test cases. The first line of each test case contains two integers M and N (1 < N, M < 20), which denote the size of the maze. The next M lines give the maze layout, with each line containing N characters. A character is one of the following: 'X' (a block of wall, which the explorer cannot enter), '.' (an empty block), 'S' (the start point of Acm), 'G' (the position of treasure), 'A', 'B', 'C', 'D', 'E' (the doors), 'a', 'b', 'c', 'd', 'e' (the keys of the doors). The input is terminated with two 0's. This test case should not be processed.
输入由多组测试用例组成。每组测试用例的第一行包含两个整数 M 和 N(1<N,M<20),表示迷宫的大小。随后的 M 行给出了迷宫布局,每行包含 N 个字符。 字符是以下之一:'X'(一堵墙,探险者无法进入),'.' (空块),'S'(Acm的起点),'G'(宝物的位置),'A','B','C','D','E'(门) , 'a', 'b', 'c', 'd', 'e'(门的钥匙)。 输入以两个 0 结束。 不应处理此测试用例。
输出
For each test case, in one line output "YES" if Acm can find the treasure, or "NO" otherwise.
对于每一个测试用例,如果Acm 可以找到宝藏,则输出”YES”,否则输出“NO”。
样例输入
4 4 
S.X. 
a.X. 
..XG 
.... 
3 4 
S.Xa 
.aXB 
b.AG 
0 0
样例输出
YES 
NO
来源
POJ Monthly,Wang Yijie
posted on 2022-02-09 22:12  咏江浪淘沙  阅读(393)  评论(0)    收藏  举报