Bella’s magic cube

Time Limit: 20000/10000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)

Problem Description

Bella is so busy these days. She wants to have fun with his GF Barty. So she bought a magic cube from DS. And command Barty to do something. STO Barty Orz can’t be so stupid to get angry. So he asks you to program for Bella’s unreasonable commands.

1. Faces

2. Rotate methods

3. Numbers

4. A system include these key words

  1. ​BeginModule - Begin the program
  2. EndModule – End the program
  3. While Q, do until you read “EndWhile”, and repeat Q times.
  4. Do-Repeat:

    Do

    ...

    ...

    ...

    Repeat Q

    Repeat Q times the codes between do -repeat

  5. Number X Y C –put number c to Face X and Position Y

  6. Print X Y C  - Color Face X and Position Y to C

  7. PrintF X C  -Color Face X to C

  8. Add A B C D  Add Face C Position D ‘s Number to Face A and Position B

  9. Change A B C D –Swap the number and color of Face A Position B and Face C Position D

  10. F F’ R R’ B B’ L L’ D D’ U U’ M M’ Rotate methods mention before

  11. // - Note the line to ignore

  12. /* */ - Note the words betwe

5. Every Faces contains  

  1. Number  in int

  2. Color: Pink Red Blue Green Yellow Orange

Input

Simple case

BeginModule

Give the 6 matrixes of number on face F、B、R、L、U、D. There is a blank between them.

Give the 6 matrixes of color on face F、B、R、L、U、D.

[Fuctions]

EndModule

Output

We guarantee the input is correct and can be solved.

By the ending of the coding , output the matrix with the same format as input.

Sample Input

BeginModule
1 2 3
4 5 6
7 8 9

1 2 3
4 5 6
7 8 9

1 2 3
4 5 6
7 8 9

1 2 3
4 5 6
7 8 9

1 2 3
4 5 6
7 8 9

1 2 3
4 5 6
7 8 9

Pink Pink Pink
Pink Pink Pink
Pink Pink Pink

Pink Pink Pink
Pink Pink Pink
Pink Pink Pink

Pink Pink Pink
Pink Pink Pink
Pink Pink Pink

Pink Pink Pink
Pink Pink Pink
Pink Pink Pink

Pink Pink Pink
Pink Pink Pink
Pink Pink Pink

Pink Pink Pink
Pink Pink Pink
Pink Pink Pink

While 1000
Do
// Barty Love Bella
Number F 5 7
Repeat 1000000
Print F 5 Yellow
EndWhile
EndModule

Sample Output

1 2 3
4 7 6
7 8 9
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
Pink Pink Pink
Pink Yellow Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink
Pink Pink Pink

Hint

保证最后的答案都在int以内

对于 20% 的数据: 0 <=Q < 10  代码行数<= 50

对于 40% 的数据:0 <=Q<100  代码行数<=100

对于 100%的数据:0<=Q<1000000代码行数<= 1000

Source

buaads

Manager

Information
Solved Number6
Submit Number28
Problem Tags
implementation
matrices
No tag edit access
温馨提示:AC后可以编辑标签哦. ^-^
Login
LoginCancel