#include using namespace std; struct cell { int x, y; int dis; cell() {} cell(int x, int y, int dis) : x(x), y(y), dis(dis) {} }; bool isInside(int x, int y, int n) { if (x >= 0 && x < n && y >= 0 && y < n) return true; return false; } void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { vectormov; vectorposmov; posmov.push_back("L"); posmov.push_back("LL"); posmov.push_back("LR"); posmov.push_back("R"); posmov.push_back("UR"); posmov.push_back("UL"); vector posm; posm.push_back("L"); posm.push_back("R"); posm.push_back("UL"); int flag=0; int dx[6] = {2, 2, 0, -2, -2, 0}; int dy[6] = {-1, 1, 2, 1, -1, -2}; int dxx[3] = {2, 0, 0}; int dyy[3] = {-1, 2, -2}; queue q; q.push(cell(i_start,j_start , 0)); cell t; int x, y; bool visit[n][n]; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) visit[i][j] = false; visit[i_start][j_start] = true; while (!q.empty()) { t = q.front(); q.pop(); visit[t.x][t.y] = true; if (t.x == i_end && t.y == j_end ){ cout<0 ; i--){ cout << mov[i]<<" "; } flag=1; break; } else { mov.clear(); } if(j_start<=j_end){ for (int i = 0; i <6; i++) { x = t.x + dx[i]; y = t.y + dy[i]; if (isInside(x, y, n) && !visit[x][y]){ q.push(cell(x, y, t.dis + 1)); mov.push_back(posmov[i]); } } } else{ for(int k=0;k> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); //printShortestPath(7, 0, 3, 4,3); return 0; }