Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1.  
  2.  
  3. String RobotCar(int[][] L) {
  4. int x = -1, y, i;
  5. String R = "", s, z;
  6. for(int[] A: L){
  7. y = (i=A[0])+(i>0?1:0)- i / 4 + 1/++A[1];
  8.  
  9. s = " LF LL LFLL L LF F F LL LFL LLL F LLFL LLFL LL LL L LL F LL FL LL FL LL LL LL LL LLLFL LLLFL LL LLFL ".replace(" ","R").split(" ")[x < 0? y : 6 + x + y + 5*(x<y?x:y)];
  10. z = "";
  11.  
  12. for(int c : s.getBytes())
  13. z = " F R L".charAt(c)+z;
  14.  
  15. R += "F"+(x < y ? s : z);
  16. x = y;
  17. }
  18. return R.replaceAll("(.)(?=.)","$1-");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement