// In the name of Allah the Most Merciful. #include using namespace std; const int MAX = 205; bool visited[MAX][MAX]; int parent[MAX][MAX]; int n , st1 , st2 , en1 , en2; vectorans; bool possible(int i , int j) { if(i<0||j<0)return false; if(i>=n||j>=n)return false; if(visited[i][j]==true)return false; return true; } void bfs() { visited[st1][st2] = true; queuecurrent; current.push(st1); current.push(st2); while(!current.empty()){ int i = current.front();current.pop(); int j = current.front();current.pop(); if(possible(i-2 , j-1)==true){ visited[i-2][j-1] = true; parent[i-2][j-1] = 1; current.push(i-2); current.push(j-1); } if(possible(i-2 , j+1)==true){ visited[i-2][j+1] = true; parent[i-2][j+1] = 2; current.push(i-2); current.push(j+1); } if(possible(i , j+2)==true){ visited[i][j+2] = true; parent[i][j+2] = 3; current.push(i); current.push(j+2); } if(possible(i+2 , j+1)==true){ visited[i+2][j+1] = true; parent[i+2][j+1] = 4; current.push(i+2); current.push(j+1); } if(possible(i+2 , j-1)==true){ visited[i+2][j-1] = true; parent[i+2][j-1] = 5; current.push(i+2); current.push(j-1); } if(possible(i , j-2)==true){ visited[i][j-2] = true; parent[i][j-2] = 6; current.push(i); current.push(j-2); } } } void path(int i , int j) { if(parent[i][j]==-1)return ; ans.push_back(parent[i][j]); int temp = parent[i][j]; if(temp==1){ path(i+2 , j+1); } else if(temp==2){ path(i+2 , j-1); } else if(temp==3){ path(i , j-2); } else if(temp==4){ path(i-2 , j-1); } else if(temp==5){ path(i-2 , j+1); } else path(i , j+2); } int main(void) { scanf("%d",&n); memset(visited , false , sizeof(visited)); for(int i=0;i0)printf(" "); if(ans[i]==1)printf("UL"); if(ans[i]==2)printf("UR"); if(ans[i]==3)printf("R"); if(ans[i]==4)printf("LR"); if(ans[i]==5)printf("LL"); if(ans[i]==6)printf("L"); } printf("\n"); } return 0; }