Transformations
A square pattern of size N x N (1 <= N <= 10) black and white square tiles is transformed into another square pattern. Write a program that will recognize the minimum transformation that has been applied to the original pattern given the following list of possible transformations:
- #1: 90 Degree Rotation: The pattern was rotated clockwise 90 degrees.
- #2: 180 Degree Rotation: The pattern was rotated clockwise 180 degrees.
- #3: 270 Degree Rotation: The pattern was rotated clockwise 270 degrees.
- #4: Reflection: The pattern was reflected horizontally (turned into a mirror image of itself by reflecting around a vertical line in the middle of the image).
- #5: Combination: The pattern was reflected horizontally and then subjected to one of the rotations (#1-#3).
- #6: No Change: The original pattern was not changed.
- #7: Invalid Transformat

该程序实现了对正方形黑白瓷砖图案的识别,通过判断90度、180度、270度旋转,水平反射及组合变换,确定从原始图案到新图案所需的最小变换。输入为变换前后的图案,输出为变换编号。程序中包含了旋转、反射等操作的定义以及等效变换的检查。
最低0.47元/天 解锁文章
193





