-
算法实现题7
算法实现题7-60 战马问题
« 问题描述:
按照国际象棋的规则,在位置(0,0)处的马可以跳到位置(1,2),(1 ,-2),(-1,2),
(-1,-2),(2,1),(2,-1),(-2,1),(-2,-1)处。战马问题中的战马具有更一般的跳跃
能力。位置(0,0)处的战马每次可以跳到k 个位置x y i k i i ( , ),1 £ £ ,中的一个位置。战
马问题要求确定给定的战马能否跳遍无限大的棋盘上的每个位置。
« 编程任务:
对于给定的战马问题中战马的跳跃能力。确定战马能否跳遍无限大棋盘上的每个位置。
« 数据输入:
由文件input.txt给出输入数据。第1 行有1个正整数k,表示位置(0,0)处的战马每
次可以跳到k个位置。接下来的k行,每行有2个整数,表示战马的跳跃位置。
« 结果输出:
将计算结果输出到文件output.txt。给定的战马能跳遍棋盘上的每个位置时输出“Yes”,
否则输出“No”。
输入文件示例 输出文件示例
input.txt output.txt
3
1 0
0 1
-2 -1
Yes
- 2022-01-27 16:50:13下载
- 积分:1
-
butterfly on nature
butterfly on nature-butterfly on nature
- 2022-03-13 04:21:16下载
- 积分:1
-
craps 游戏源码。Very popular game in U.S. player rolls two dice each time.
craps 游戏源码。Very popular game in U.S. player rolls two dice each time.-craps game source code. Very popular game in US player rolls two dice each time.
- 2022-01-25 17:44:24下载
- 积分:1
-
以重排九宫问题为例演示全局择优搜索法的搜索过程,要求有一定的普适性。...
以重排九宫问题为例演示全局择优搜索法的搜索过程,要求有一定的普适性。-Rearrangement of Lo Shu Square as an example to demonstrate the overall selection of the best search method searching process, requiring a certain degree of universality.
- 2022-08-23 03:00:21下载
- 积分:1
-
VC++精品源码打包下载,里面包含很多常用的代码。希望对你有帮助...
VC++精品源码打包下载,里面包含很多常用的代码。希望对你有帮助-VC++ elaborate code collection to download,included much very useful source code,hope it will be helpful to you.
- 2022-07-16 09:37:57下载
- 积分:1
-
matlab 图象开发 chapter 4
matlab 图象开发 chapter 4-Matlab Image Development chapter 4
- 2022-07-09 13:53:54下载
- 积分:1
-
一个很强的屏幕放大镜,并可叠加其他颜色。
一个很强的屏幕放大镜,并可叠加其他颜色。-A very strong magnifying glass screen, and overlay other colors.
- 2023-05-21 21:15:02下载
- 积分:1
-
s3c2440 drivers in c for wince5.0
s3c2440 drivers in c for wince5.0
- 2022-10-14 06:00:03下载
- 积分:1
-
语音记事本,实现文字排板,格试设置等常用功能,加语音郎读...
语音记事本,实现文字排板,格试设置等常用功能,加语音郎读-phonetic notice book
- 2022-10-26 11:45:03下载
- 积分:1
-
tcp 网络文件传输工具实例
tcp 网络文件传输工具实例-tcp network file transfer tool examples
- 2023-02-15 00:15:03下载
- 积分:1