Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

无聊的模拟题,用3维数组还记录转移方向

Posted by dongshanluo at 2011-09-25 17:41:50 on Problem 3434
定义发如下4种方向的值
    B  -> 2       bbbbb
    bbbbb         B--->3

   aaaaA  ->0    Aaaaa ->1

用此来根据头得到下一步的方向
static int dir[4][3] = {{0, 1, 1}, {0, -1, 0},{1, 0, 2},{-1, 0, 3}};

用此来移动
第一维是自己的当前方向
接下来的[3][3]是自己可以选择的移动方向及移动之后的方向
static int next[4][3][3] =
{
    {{0, 1, 0}, {1, 0, 3}, {-1, 0, 2}},
    {{0, -1, 1}, {-1, 0, 2}, {1, 0, 3}},
    {{-1, 0, 2}, {0, 1, 0}, {0, -1, 1}},
    {{1, 0, 3}, {0, -1, 1}, {0, 1, 0}}
};

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator