69,369
社区成员
发帖
与我相关
我的任务
分享
1. build your interface concept, grasp the problem, implement the logic in program under the contract of that interface;
2. and these are some references for a 90 degrees clockwise rotation of an X * X matrix of integers,
- a special version for 4 x 4 matrix,
http://www.google.com/notebook/public/04843391034506425457/BDQ_UIgoQiNaqocoh
- updated version for matrix in any size provided its length equals to width
http://www.cyberspace.org/~jhl/miscc.c
/*******************************************************************************
* Function : void *mtxrot(void *mtx)
* Author : lovecreatesbeauty@gmail_Del.com [Remove _Del for email]
* Date : 2007.10.7
* Description: Rotate a matrix of integers of any size by 90 degrees colckwise
* if its length equals to width, for example,
*
* for a 5 x 5 matrix:
*
* 1 2 3 4 5
* 6 7 8 9 10
* 11 12 13 14 15
* 16 17 18 19 20
* 21 22 23 24 25
*
* 21 16 11 6 1
* 22 17 12 7 2
* 23 18 13 8 3
* 24 19 14 9 4
* 25 20 15 10 5
*
*
* for a 6 x 6 matrix:
*
* 1 2 3 4 5 6
* 7 8 9 10 11 12
* 13 14 15 16 17 18
* 19 20 21 22 23 24
* 25 26 27 28 29 30
* 31 32 33 34 35 36
*
* 31 25 19 13 7 1
* 32 26 20 14 8 2
* 33 27 21 15 9 3
* 34 28 22 16 10 4
* 35 29 23 17 11 5
* 36 30 24 18 12 6
*
******************************************************************************/