这一题需要使用搜索,由于这题数据给的比较小,甚至不用剪枝也能够AC,因为题意也比较直接,所以我们直接来看代码。
#include<iostream>
#include<cstdio>
using namespace std;
const int map_std[6][6] = {
{0,0,0,0,0,0},
{0,2,2,2,2,2},
{0,1,2,2,2,2},
{0,1,1,0,2,2},
{0,1,1,1,1,2},
{0,1,1,1,1,1}};//标准图
const int dx[]={-2,-1, 1, 2, 2, 1,-1,-2}; //八个方向
const int dy[]={ 1, 2, 2, 1,-1,-2,-2,-1};
const int max