#include<iostream> #include<algorithm> using namespace std; typedef unsigned long long ull; const int MX[] = {0,-1,-2,-2,-1,1,2,2,1}; const int MY[] = {0,-2,-1,1,2,2,1,-1,-2}; ull destination[30][30]; int book[30][30]; int main(){ int dx,dy,mx,my; cin >> dx >> dy >> mx >> my; ++dx;++dy;++mx;++my; destination[1][1] = 1; book[mx][my] = 1; for(int i = 1; i <= 8;i++) book[mx + MX[i]][my + MY[i]] = 1; for(int i = 1;i <= dx;i++) for(int j = 1;j <= dy;j++){ if(book[i][j]) continue; destination[i][j] = max(destination[i][j],destination[i-1][j]+destination[i][j-1]); } cout << destination[dx][dy]; }
|