本文共 827 字,大约阅读时间需要 2 分钟。
这题时候是一个bfs
模拟长方体的各种状态 代码量大了点而已#include#include using namespace std;int n,m,x1,y1,px[2500005],py[2500005],pt[2500005],ps[2500005],a[505][505],c[505][505][5];int dx[4][4]={ { },{ -1,0,2,0},{ -1,0,1,0},{ -2,0,1,0}};//几种移动int dy[4][4]={ { },{ 0,2,0,-1},{ 0,1,0,-2},{ 0,1,0,-1}};int dt[4][4]={ { },{ 3,2,3,2},{ 2,1,2,1},{ 1,3,1,3}};bool check(int x,int y,int t)//判断{ if(x<1||x>n||y<1||y>m)return false; if(t==1) { if(a[x][y]=='E')return false; if(a[x][y]=='#')return false; } if(t==2) { if(a[x][y]=='#')return false; if(a[x][y-1]=='#')return false; } if(t==3) { if(a[x][y]=='#')return false; if(a[x-1][y]=='#')return false; } if(c[x][y][t]==1)return false; return true; }void bfs()//bfs{ int head=0,tail=1; while(head
转载地址:http://duvzz.baihongyu.com/