#include #include #include #include #include #include #include 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. int i,c=0,k=0; char str[1000000][4]; if(i_start>i_end) { while(1){ if((i_start==i_end)&&(j_start==j_end)) { break; } else if((i_start-2>=0)&&(j_start-2>=0)) { strcpy(str[k],"UL"); k++; c++; } else if((i_start-2>=0)&&(j_start+1j_end)) { strcpy(str[k],"L"); k++; c++; } else { printf("Impossible"); exit(0); } } } else { while(1){ if((i_start==i_end)&&(j_start==j_end)) { break; } else if((i_start+2>n)&&(j_start+1=0)) { strcpy(str[k],"LL"); k++; c++; } else if((i_start==i_end)&&(j_startj_end)) { strcpy(str[k++],"L"); k++; c++; } else { printf("Impossible"); exit(0); } } } printf("%d\n",c); for(i=0;i