1.18号英语翻译


题目来源:https://acs.jxnu.edu.cn/problem/POJ2488

注:红色字体为翻译部分

重要单词:

chessboard :n.棋盘;

rectangular:adj.矩形的

 adventurous:adj.爱冒险的

 scenario:n.场景

 lexicographically:adv.字典顺序排列地

concatenate:v.连接

A Knight's Journey

一个骑士的旅程

 1000ms  65536K

描述:

Background The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it is two squares in one direction and one square perpendicular to this. The world of a knight is the chessboard he is living on. Our knight lives on a chessboard that has a smaller area than a regular 8 * 8 board, but it is still rectangular. Can you help this adventurous knight to make travel plans? 背景:
这名骑士对一遍又一遍地看见相同的黑白方块感到很厌倦,并决定来一次世界之旅。每当一个骑士移动的时候,它是一个方向的两个方格和一个方格垂直于这个方向。这骑士的世界就是它赖以生存的棋盘。我们的骑士生活在一个面积比普通的8*8棋盘还要小的棋盘上,但是它依旧是矩形的。你能帮这个爱冒险的骑士制定旅行计划吗?
Problem Find a path such that the knight visits every square once. The knight can start and end on any square of the board. 问题: 找出一条路径能够使这个骑士访问到每个方格一次。这个骑士可以从任意一个方格起始和终止。

输入:

The input begins with a positive integer n in the first line. The following lines contain n test cases. Each test case consists of a single line with two positive integers p and q, such that 1 <= p * q <= 26. This represents a p * q chessboard, where p describes how many different square numbers 1, . . . , p exist, q describes how many different square letters exist. These are the first q letters of the Latin alphabet: A, . . . 输入的第一行是一个正整数n。之后的几行中包含n个测试用例。每一个测试用例由一行包含两个正整数p和q组成,且1<=p*q<=26。这代表一个P*q的棋盘,p描述了有多少个不同的方格,其编号为1········p,q描述了有多少个不同的字母方格存在。这些是拉丁字母表的前 q 个字母:A, . . .

输出:

The output for every scenario begins with a line containing "Scenario #i:", where i is the number of the scenario starting at 1. Then print a single line containing the lexicographically first path that visits all squares of the chessboard with knight moves followed by an empty line. The path should be given on a single line by concatenating the names of the visited squares. Each square name consists of a capital letter followed by a number.
If no such path exist, you should output impossible on a single line. 每个场景的输出都以包含“场景 #i:”的行开头,其中 i 是场景的编号,从 1 开始。然后打印一行,其中包含按字典顺序排列的第一条路径,该路径能够使该骑士移动访问棋盘的所有方格,然后是空行。这个路径应该通过连接所访问方块的名称在单行上给出。每个方格名称由一个大写字母后跟一个数字组成。

样例输入:

3
1 1
2 3
4 3

样例输出:

Scenario #1:
A1

Scenario #2:
impossible

Scenario #3:
A1B3C1A2B4C2A3B1C3A4B2C4

注释:

Source: TUD Programming Contest 2005, Darmstadt, Germany

相关