Grid walking algorithm code correction
问题 Grid Walking (Score 50 points): You are situated in an N dimensional grid at position (x_1,x2,...,x_N) . The dimensions of the grid are (D_1,D_2,...D_N) . In one step, you can walk one step ahead or behind in any one of the N dimensions. (So there are always 2N possible different moves). In how many ways can you take M steps such that you do not leave the grid at any point? You leave the grid if you for any x_i , either x_i <= 0 or x_i > D_i . Input: The first line contains the number of test