当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6401:Magic Square

题目描述
A magic square is a $3 \times 3$ square, where each element is a single digit between 1 and 9 inclusive, and each digit appears exactly once. There are 4 different contiguous $2 \times 2$ subsquares in a magic squares, which are labeled from 1 to 4 as the following figure shows. These $2 \times 2$ subsquares can be rotated. We use the label of the subsquare with an uppercase letter to represent a rotation. If we rotate the subsquare clockwise, the letter is 'C'; if we rotate it counterclockwise, the letter is 'R'. The following figure shows two different rotations.



Now, given the initial state of a magic square and a sequence of rotations, please print the final state of the magic square after these rotations are performed.
输入解释
The first line of input is a single integer $T$ $(1 \leq T \leq 100)$, the number of test cases.

Each test case begins with a single integer $n$ $(1 \leq n \leq 100)$, the number of rotations. It is then followed by a $3 \times 3$ square, where every digit between 1 and 9 inclusive appears exactly once, representing the initial state of the magic square. The following $n$ lines describe the sequence of rotations.

The test data guarantees that the input is valid.
输出解释
For each test case, display a $3 \times 3$ square, denoting the final state of the magic square.
输入样例
1
2
123
456
789
1C
4R
输出样例
413
569
728
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6401

最后修改于 2020-10-25T23:31:00+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)