#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. char str[25][3]; int count=0; while(1) { if(i_start>i_end) { if(j_start>j_end) { i_start=i_start-2; j_start=j_start-1; if(j_start>=j_end&&i_start>=i_end) { //printf("UL "); strcpy(str[count++],"UL\0"); } else { printf("Impossible"); break; } } else if(j_startj_end) { i_start=i_start+2; j_start=j_start-1; if(j_start>=j_end&&i_start>=i_end) { //printf("UL "); strcpy(str[count++],"LL\0"); } else { printf("Impossible"); break; } } else if(j_startj_end) { j_start-=2; if(j_start>j_end) { strcpy(str[count++],"L\0"); } else if(j_start==j_end) { strcpy(str[count++],"L\0"); break; } } else {printf("Impossible"); break; } } else if(i_start==i_end) { if(j_startj_end) { strcpy(str[count++],"R\0"); } else if(j_start==j_end) { strcpy(str[count++],"R\0"); break; } } else {printf("Impossible"); break; } } } if(count<=n&&count>0) { printf("%d\n",count); for(int i=0;in) { printf("Impossible"); } } int main() { int n; scanf("%i", &n); int i_start; int j_start; int i_end; int j_end; scanf("%i %i %i %i", &i_start, &j_start, &i_end, &j_end); printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }