1 solutions
-
0
C++ :
#include <cstdio> #include <cstring> #include <iostream> using namespace std; const int maxn=110,dx[8]={2,1,-1,-2,-2,-1,1,2},dy[8]={1,2,2,1,-1,-2,-2,-1}; int x,y,m,n; long long a[maxn][maxn]; bool b[maxn][maxn]; int main() { scanf("%d%d%d%d",&n,&m,&x,&y); memset(b,true,sizeof(b)); a[0][0]=1; b[x][y]=false; for(int i=0;i!=8;++i) if(x+dx[i]>=0&&x+dx[i]<=m&&y+dy[i]>=0&&y+dy[i]<=n) b[x+dx[i]][y+dy[i]]=false; for(int i=1;i<=n;++i) if(b[i][0]) a[i][0]=a[i-1][0]; for(int j=1;j<=m;++j) if(b[0][j]) a[0][j]=a[0][j-1]; for(int i=1;i<=n;++i) for(int j=1;j<=m;++j) if(b[i][j]) a[i][j]=a[i-1][j]+a[i][j-1]; cout<<a[n][m]<< endl; return 0; }
- 1
Information
- ID
- 16902
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By