#include using namespace std; void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. typedef struct{ int row; int col; string str; }Vertex; int count = 0; int numVertex = n*n; bool visited[200][200] = { false }; string str1, str2, str3, str4, str5, str6; queue Q; Vertex start = { i_start, j_start }; visited[i_start][j_start] = true; Q.push(start); while(!Q.empty()){ Vertex v = Q.front(); Q.pop(); for(int i = 1; i <= 6; i++){ switch(i){ case 1://UL if(v.row - 2 >= 0 && v.col - 1 >= 0 && visited[v.row - 2][v.col - 1] == false) { visited[v.row - 2][v.col - 1] =true; Vertex temp = { v.row - 2, v.col - 1 ,v.str+" UL"}; Q.push(temp); str1 += "UL "; if(temp.row == i_end && temp.col == j_end) { for(int i=0;i<(temp.str).size();i++) if((temp.str)[i]==' ') count++; cout<= 0 && v.col + 1 = 0 && visited[v.row + 2][v.col - 1] == false) { visited[v.row + 2][v.col - 1] = true; Vertex temp = { v.row + 2, v.col - 1 ,v.str+" LL"}; Q.push(temp); str5 += "LL "; if(temp.row == i_end && temp.col == j_end) { for(int i=0;i<(temp.str).size();i++) if((temp.str)[i]==' ') count++; cout<= 0 && visited[v.row][v.col - 2] == false) { visited[v.row][v.col - 2] = true; Vertex temp = { v.row, v.col - 2 ,v.str+" L"}; Q.push(temp); str6 += "L "; if(temp.row == i_end && temp.col == j_end) { for(int i=0;i<(temp.str).size();i++) if((temp.str)[i]==' ') count++; cout<> 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); return 0; }