import java.util.Scanner; public class Main{ public static int mod = (int)1e9+7; //暴力递归的解法 public static int walk(int N, int cur, int rest, int P){ //递归终止条件 if(rest == 0){ return cur == P ? 1 : 0; } if(cur == 1){ return walk(N,2,rest-1,P); ...