12150 - moocFinal5_迴旋   

Description

Input two integers M and N. Generate a MxN matrix circling clockwise from the outer ring to the center.
For example, M is 3 and N is 4:
1  2  3  4
10 11 12  5
 9  8  7  6
And another example, M is 4 and N is 4:
1  2  3  4
12 13 14  5
11 16 15  6
10  9  8  7
The problem will ask for a number and you need to output where it is.

 

Input

Three integers M, N, and P.
This means you need to find where number P is in the MxN circling matrix. M and N won’t exceed 30.

 

Output

Two numbers separated by space. Remember to add newline at the end.
The two numbers represent row and column respectively.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss