Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String RobotCar(int[][] L) {
- int x = -1, y, i;
- String R = "", s, z;
- for(int[] A: L){
- y = (i=A[0])+(i>0?1:0)- i / 4 + 1/++A[1];
- 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)];
- z = "";
- for(int c : s.getBytes())
- z = " F R L".charAt(c)+z;
- R += "F"+(x < y ? s : z);
- x = y;
- }
- return R.replaceAll("(.)(?=.)","$1-");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement