样例输入:N=2
样例输出:result=7
样例输入:N=3
样例输出:result=17
import java.util.Scanner;
public class Foot {
static int t = 0;
public static void main(String[] args) {
int n=new Scanner(System.in).nextInt();
int[][] a = new int[n+1][2*n+1];
int x = n;
int y = n;
a[x][y] = 1;
xunhuan(a,n,x,y);
System.out.println(t);
}
private static void xunhuan(int[][] a, int n, int x, int y) {
if(n!=0){
if(a[x-1][y] != 1){
a[x-1][y] = 1;
xunhuan(a,n-1,x-1,y);
a[x-1][y] = 0;
}
if (a[x][y+1] != 1) {
a[x][y+1] = 1;
xunhuan(a,n-1,x,y+1);
a[x][y+1] = 0;
}
if (a[x][y-1] != 1) {
a[x][y-1] = 1;
xunhuan(a,n-1,x,y-1);
a[x][y-1] = 0;
}
}else{
t++;
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[i].length; j++) {
System.out.print(a[i][j]);
}
System.out.println();
}
System.out.println();
}
}
}