P1002 过河卒

#include<iostream>
#include<cstdio>
#define ll long long 
ll a,b,n,m,l[22][22],map[23][23];
using namespace std;
void bj(ll x,ll y)
{
	map[x][y]=1;
	map[x-1][y-2]=1;
	map[x-2][y-1]=1;
	map[x-2][y+1]=1;
	map[x-1][y+2]=1;
	map[x+1][y-2]=1;
	map[x+2][y-1]=1;
	map[x+2][y+1]=1;
	map[x+1][y+2]=1;
	
}
int main()
{
	scanf("%lld%lld%lld%lld",&n,&m,&a,&b);
	bj(a,b);
	l[1][0]=1;
	for(int i=1;i<=n+1;i++)
	 for(int j=1;j<=m+1;j++)
	  {
	  	l[i][j]=l[i-1][j]+l[i][j-1];
	  	if(map[i-1][j-1]) l[i][j]=0;
	  }
	printf("%lld",l[n+1][m+1]);
	return 0;
}

相关文章:

  • 2021-09-11
  • 2022-12-23
  • 2022-01-29
  • 2021-07-09
  • 2022-12-23
  • 2022-01-04
猜你喜欢
  • 2021-06-20
  • 2021-06-05
  • 2022-01-29
  • 2021-07-21
  • 2021-10-25
相关资源
相似解决方案