提交时间:2023-10-04 11:28:45
运行 ID: 104951
#include<bits/stdc++.h> using namespace std; int main() { int n,m,x,y,f[20][20]; 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==0) f[i][j]=1; else if(j==0) f[i][j]=1; else f[i][j]=f[i-1][j]+f[i][j-1]; cout<<f[i][j]<<' '; } cout<<endl; } cout<<f[n][m]; return 0; }