提交时间:2023-04-19 21:58:23
运行 ID: 15148
#include<bits/stdc++.h> using namespace std; long long a[101][101]; int main() { int y1,x1,x,y,i,j; cin>>y1>>x1>>x>>y; for(int i=0;i<=y1;i++) for(int j=0;j<=x1;j++)a[i][j]=1; a[x][y]=0; if(x-1>=0&&y-2>=0)a[x-1][y-2]=0; if(x-2>=0&&y-1>=0)a[x-2][y-1]=0; if(x-2>=0&&y+1<=x1)a[x-2][y+1]=0; if(x-1>=0&&y+2<=x1)a[x-1][y+2]=0; if(x+1<=y1&&y+2<=x1)a[x+1][y+2]=0; if(x+2<=y1&&y+1<=x1)a[x+2][y+1]=0; if(x+2<=y1&&y-1>=0)a[x+2][y-1]=0; if(x+1<=y1&&y-2>=0)a[x+1][y-2]=0; for(int i=0;i<=y1;i++) { for(int j=0;j<=x1;j++) { if(i==0&&i==j) continue; if(a[i][j]==0) continue; if(i==0) a[i][j]=a[i][j-1]; if(j==0) a[i][j]=a[i-1][j]; if(i!=0&&j!=0&&a[i][j]!=0) a[i][j]=a[i-1][j]+a[i][j-1]; } } cout<<a[y1][x1]; return 0; }