正文
增加 9 行删除 9 行
12 行未改动1314151617181920212211 行未改动3435363738394041424344454647484950515253545556575859606136 行未改动12 行未改动using namespace std;#define rx registerconst int maxn=10;const int dx[maxn]={0,1,1,-1,-1,2,2,-2,-2};const int dy[maxn]={0,2,-2,2,-2,1,-1,1,-1};//步数const int mason[maxn][maxn]={//2是空格,0白,1黑{0,0,0,0,0,0},{0,1,1,1,1,1},{0,0,1,1,1,1},{0,0,0,2,1,1},11 行未改动if(now[i][j]!=mason[i][j])tot++;}}return tot;}void IDA_star(int step,int x,int y,int mdep)//mdep最大深度{if(step==mdep){if(!f())flag=1;//全部归位return;}for(int i=1;i<=8;i++){int nx=x+dx[i],ny=y+dy[i];if(nx<1 || nx>5 || ny<1 || ny>5)continue;//手欠打错了调了30minQwQswap(now[x][y],now[nx][ny]);if(step+f()<=mdep){IDA_star(step+1,nx,ny,mdep);}swap(now[x][y],now[nx][ny]);//回溯}}char ch;signed main(){scanf("%d",&t);36 行未改动12 行未改动1314151617181920212211 行未改动3435363738394041424344454647484950515253545556575859606136 行未改动12 行未改动using namespace std;#define rx registerconst int maxn=10;const int dx[maxn]={0,1,1,-1,-1,2,2,-2,-2};const int dy[maxn]={0,2,-2,2,-2,1,-1,1,-1};//步数const int mason[maxn][maxn]={//2是空格,0白,1黑{0,0,0,0,0,0},{0,1,1,1,1,1},{0,0,1,1,1,1},{0,0,0,2,1,1},11 行未改动if(now[i][j]!=mason[i][j])tot++;}}return tot;}void IDA_star(int step,int x,int y,int mdep)//mdep最大深度{if(step==mdep){if(!f())flag=1;//全部归位return;}for(int i=1;i<=8;i++){int nx=x+dx[i],ny=y+dy[i];if(nx<1 || nx>5 || ny<1 || ny>5)continue;//手欠打错了调了30minQwQswap(now[x][y],now[nx][ny]);if(step+f()<=mdep){IDA_star(step+1,nx,ny,mdep);}swap(now[x][y],now[nx][ny]);//回溯}}char ch;signed main(){scanf("%d",&t);36 行未改动