Rotate X12162


Statement
 

pdf   zip

html

To confuse his pursuers, Neo has invented a way to rotate the Matrix. However, Neo can only rotate the Matrix 90, 180, or 270. Help Neo compute a given rotation of the Matrix.

Input

The input consists of several test cases. Each test case starts with the number of rows 1≤ n≤ 100 and the number of columns 1≤ m≤ 100 of the Matrix, as well as the number of degrees d that Neo wants to rotate the Matrix. This is followed by n rows with m integers each.

Output

For each test case, the matrix that results from rotating the Matrix d degrees.

Public test cases
  • Input

    3 4 90
    9 1 2 4
    2 7 2 3
    7 5 1 3
    

    Output

    4 3 3
    2 2 1
    1 7 5
    9 2 7
    
  • Input

    4 2 0
    9 2
    4 7
    1 5
    3 8
    

    Output

    9 2
    4 7
    1 5
    3 8
    
  • Input

    3 3 180
    9 1 2
    6 2 7
    8 4 4
    

    Output

    4 4 8
    7 2 6
    2 1 9
    
  • Information
    Author
    Anders Jonsson
    Language
    English
    Official solutions
    Unknown. This problem is being checked.
    User solutions
    C++