翻译、、、

Rotations and Reflections | JXNUOJ

Rotations and Reflections

1000ms 32768K

描述:

Many games, tricks and puzzles depend on determining whether two patterns on a rectangular grid are the ``same'' or not. For instance, the 96 different ways of arranging 8 queens safely on a chessboard can be shown to consist of rotations and/or reflections of only 12 basic patterns.

Write a program that will read in pairs of patterns and determine whether there is a simple transformation that will convert one into the other. Because symmetrical patterns bear many relationships to each other, the transformations must be checked in a specific order. The possible transformations (in order) are:

Preservation:           The patterns are identical

90 degree rotation :    The pattern was rotated clockwise by 90 degrees

180 degree rotation:    The pattern was rotated clockwise by 180 degrees

270 degree rotation:    The pattern was rotated clockwise by 270 degrees

Reflection:             The pattern was reflected about the horizontal axis (effectively by a mirror held at the top of the pattern)

Combination:            A reflection (as above), followed by one of the above rotations

Improper:               The patterns do not match under any of the above transformations

输入:

Input will consist of a series of pairs of patterns. Each set will consist of a line containing a single integer N (2 <= N <= 10) giving the size of the patterns, followed by N lines. Each line will consist of N dots or `x's (specifying a line of the original pattern), a space, and another set of N dots and `x's (specifying a line of the transformed pattern). The file will be terminated by a line consisting of a single zero (0).
 

输出:

Output will consist of a series of lines, one for each pattern pair in the input. Each line will consist of one of the following: `Preserved', `Rotated through m degrees' (where m is one of 90, 180 or 270), `Reflected', `Reflected and rotated through m degrees', `Improper'.

许多游戏、把戏和谜题取决于确定矩形网格上的两个图案是否“相同”。例如,在棋盘上安全排列8个皇后的96种不同方式可以显示为只包含12种基本图案的旋转和/或反射。

编写一个程序,将读取成对的模式,并确定是否存在将一种模式转换为另一种模式的简单转换。由于对称图案彼此之间有许多关系,因此必须按特定顺序检查变换。可能的转换(顺序)为:

保存:模式相同

90度旋转:图案顺时针旋转90度

180度旋转:图案顺时针旋转180度

270度旋转:图案顺时针旋转270度

反射:图案围绕水平轴反射(通过图案顶部的镜子有效反射)

组合:反射(如上所述),然后是上述旋转之一

不正确:在上述任何转换下,模式都不匹配

输入:

输入将由一系列成对的模式组成。每组将由一行组成,其中包含一个整数N(2<=N<=10),给出图案的大小,然后是N行。每行由N个点或'x'组成(指定原始图案的一行)、一个空格和另一组N个点和'x'组成(指定变换图案的一行)。该文件将由一个由零(0)组成的行终止。

输出:

输出将由一系列行组成,输入中的每个模式对对应一行。每一行将包括以下内容之一:`保留',`旋转m度'(其中m是90度、180度或270度中的一个),`反射',`反射并旋转m度',`不适当'。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值