60分,求助
查看原帖
60分,求助
178128
杨凯楼主2020/9/16 15:39
#include<bits/stdc++.h>
using namespace std;
int bx,by,hx,hy;
long long int num[25][25];
bool v[25][25];
int move(int x,int y)
{
	if(x<0||y<0)return 0;
 	if(x==hx&&y==hy)return 0;
	if(x==hx+2&&y==hy+1)return 0;
	if(x==hx+2&&y==hy-1)return 0;
	if(x==hx-2&&y==hy+1)return 0;
	if(x==hx-2&&y==hy-1)return 0;
	if(x==hx+1&&y==hy+2)return 0;
	if(x==hx+1&&y==hy-2)return 0;
	if(x==hx-1&&y==hy+2)return 0;
	if(x==hx-1&&y==hy-2)return 0; 
	if(x==0&&y==0)return 1;
	if(v[x][y])return num[x][y];
	num[x][y]=move(x-1,y)+move(x,y-1);
	v[x][y]=1;
	return num[x][y];
}
int main()
{
  cin>>bx>>by>>hx>>hy;
  cout<<move(bx,by);
  return 0;
}
2020/9/16 15:39
加载中...