递归代码
#include<iostream>
#include<cstdio>
using namespace std;
int n,m,x,y,sum=1;
void dfs(int a,int b)
{
if(a==n&&b==m)
{
return;
}
if(a>n||b>m)
{
sum--;
return;
}
if((a==x&&b==y)||(a==x-1&&b==y-2)||(a==x-2&&b==y-1)||(a==x-2&&b==y+1)||(a==x-1&&b==y+2)||(a==x+1&&b==y+2)||(a==x+2&&b==y+1)||(a==x+2&&b==y-1)||(a==x+1&&b==y-2))
{
sum--;
return;
}
sum++;
dfs(a+1,b);
dfs(a,b+1);
}
int main()
{
scanf("%d%d%d%d",&n,&m,&x,&y);
dfs(0,0);
printf("%d\n",sum);
return 0;
}