目前本站已有 十几万 份求职资料啦!


发autodesk矩阵题答案$autodesk$

10-15 23:59:20 来源:http://www.qz26.com 笔试题目   阅读:8510
导读: #include "iostream"using namespace std;#define RIGHT 1#define DOWN 2#define LEFT 3#define UP 4int judge(int step, int walk, int flag){if( walk switch(flag){case RIGHT:return DOWN;case DOWN:return LEFT;case LEFT:return UP;case UP:return RIGHT;}}void matrix(int N){int length = N * N;int *p = new int[length];int flag = RIGHT;int step = N;int count = 0;int walk = -1;for(int i = 0 ; i {walk = 1;int newflag = judge(step , walk , flag);if(flag != newf
发autodesk矩阵题答案$autodesk$,标签:银行笔试题目,企业笔试题目,http://www.qz26.com

  


#include "iostream"
using namespace std;

#define RIGHT 1
#define DOWN 2
#define LEFT 3
#define UP 4

int judge(int step, int walk, int flag)
{
if( walk < step )return flag;
switch(flag)
{
case RIGHT:
return DOWN;
case DOWN:
return LEFT;
case LEFT:
return UP;
case UP:
return RIGHT;
}
}

void matrix(int N)
{
int length = N * N;
int *p = new int[length];
int flag = RIGHT;
int step = N;
int count = 0;
int walk = -1;
for(int i = 0 ; i < length ; i )
{
walk = 1;
int newflag = judge(step , walk , flag);

if(flag != newflag)
{
count = 1;
flag = newflag;
walk = 0;
if( (count 1) % 2 == 0 )
{
step -= 1;
}
}


switch(flag)
{
//right
case RIGHT:
if(i == 0)
p[i] = 0;
else
p[i] = p[i - 1] 1;
break;
//down

case DOWN:
p[i] = p[i - 1] N;
break;
//left
case LEFT:
p[i] = p[i - 1] - 1;
break;
//up
case UP:
p[i] = p[i - 1] -N;
}

}

int *tmp = new int[length];

for(int j = 0; j < length; j )
{
tmp[p[j]] = j 1;
}

for(j = 0; j < length; j )
{
cout << tmp[j] << " ";
if( ((j % N) == (N - 1)) )cout << "
";
}

}



void main()
{
matrix(7);
system("pause");
}


Tag:笔试题目银行笔试题目,企业笔试题目求职笔试面试 - 笔试题目
【字号: 】 【打印】 【关闭
下一条:反应能力
《发autodesk矩阵题答案$autodesk$》相关文章
最新更新
推荐热门
联系我们 | 网站地图 | 财务资料 | 范文大全 | 求职简历 | 财会考试 | 成功励志
Copyright 二六求职资料网 All Right Reserved.
1 2 3 4 5 6 7 8 9 10