#i nclude"stdio.h" int k=0; int a[16][16]; int X,Y,c,d; void fun(int i,int j) { if(i==X&&j==Y) { k++; } if(i+1<=X&&a[i+1][j]) fun(i+1,j); if(j+1<=Y&&a[i][j+1]) fun(i,j+1); } int main() { int s,t; scanf("%d",&X); scanf("%d",&Y); scanf("%d",&c); scanf("%d",&d); for(s=0;s<=X;s++) for(t=0;t<=Y;t++) a[s][t]=1; if(c<=X&&d<=Y) a[c][d]=0; if(c-1>=0) { if(d+2<=Y) a[c-1][d+2]=0; if(d-2>=0) a[c-1][d-2]=0; } if(c+1<=X) { if(d+2<=Y) a[c+1][d+2]=0; if(d-2>=0) a[c+1][d-2]=0; } if(c-2>=0) { if(d-1>=0) a[c-2][d-1]=0; if(d+1<=Y) a[c-2][d+1]=0; } if(c+2<=X) { if(d-1>=0) a[c+2][d-1]=0; if(d+1<=Y) a[c+2][d+1]=0; } fun(0,0); printf("%d\n",k); return 0; }
1823 317430过河卒 8731 01573
最新推荐文章于 2024-10-27 09:42:12 发布