Problems
Mouse and corns
Mouse and corns
In the Indian temple the floor has rectangular form filled with identical square tiles 1 х 1. Each tile contains from 0 to k (k ≤ 30000) corns. A mouse runs out from a left lower corner and go to the exit in right upper corner.
Mouse can go only right or forward, collecting all the corns from the tiles where it resides.
Find the route, where mouse can take as much corn as possible.
Input
The first line contains m and n (1 ≤ m, n ≤ 100) - the floor size . Next we have m lines, starting from top, each contains n numbers - the number of corns on the floor.
Output
Print the route of the mouse in format: RRFFFRF (F - step forward, R – step right).
Input example #1
2 3 3 2 4 1 5 1
Output example #1
RFR
Input example #10
10 10 3 2 0 0 0 0 0 0 0 0 0 2 10 0 0 0 0 0 0 0 0 0 9 3 0 0 0 0 0 0 0 0 0 9 2 0 0 0 0 0 0 0 0 0 2 3 0 0 0 0 0 0 0 0 0 4 3 0 0 0 0 0 0 0 0 0 1 5 0 0 0 0 0 0 0 0 0 8 10 0 0 0 0 0 0 0 0 0 1 8 0 0 0 0 0 0 0 0 0 5
Output example #10
FFFFFFFRRFFRRRRRRR