萌新求教
查看原帖
萌新求教
564329
red_farmer楼主2021/9/5 22:00
#include<iostream>
using namespace std;

int mx, my, fx, fy;
int x=0, y=0, numbers=0;
int search(int x1, int y1){
    if(x1==fx,y1==fy) {return 1;}
    if(x1==mx&&y1==my) {return 0;}
    if(x1+2==mx&&y1+1==my) {return 0;}
	if(x1+1==mx&&y1+2==my) {return 0;}
	if(x1-2==mx&&y1-1==my) {return 0;}
	if(x1-1==mx&&y1-2==my) {return 0;}
	if(x1+2==mx&&y1-1==my) {return 0;}
	if(x1-2==mx&&y1+1==my) {return 0;}
	if(x1+1==mx&&y1-2==my) {return 0;}
	if(x1-1==mx&&y1+2==my) {return 0;}
	if(x1>fx||y1>fy) {return 0;}
	else {return search(x1+1,y1)+search(x1, y1+1); }  
}

int main(){
  cin >> fx >> fy >> mx >> my;
  numbers=search(x, y);
  cout << numbers;
  return 0;
}

2021/9/5 22:00
加载中...