提交时间:2023-10-09 14:00:35
运行 ID: 106087
#include<bits/stdc++.h> using namespace std; long long n,m,x,y,f[21][21]; int main() { cin>>n>>m>>x>>y; for(int i=0;i<=n;i++) { for(int j=0;j<=m;j++) { if((i==x&&j==y)||(i==x+2&&j==y+1)||(i==x-2&&j==y+1)||(i==x+2&&j==y-1)||(i==x-2&&j==y-1)||(i==x+1&&j==y+2)||(i==x-1&&j==y+2)||(i==x+1&&j==y-2)||(i==x-1&&j==y-2)) f[i][j]=0; else if(!i&&!j) f[i][j]=1; else if(!i) f[i][j]=f[i][j-1]; else if(!j) f[i][j]=f[i-1][j]; else f[i][j]=f[i-1][j]+f[i][j-1],f[i][j]; } } cout<<f[n][m]; return 0; }