编辑代码

import java.util.Scanner;
public class Main{
    static int a=0;


    boolean Jud(int a,int b,int c,int d)//判断点(a,b)是否在(c,d)的冲突点上,即马蹄子上面
    {
        boolean retr=null;
        int Jude=a-c;
        if (Jude==1)||(Jude==-1)
            switch(b-d){
                case 2: retr=true;break;
                case -2:retr=true;break;
                default:retr=false;
            }
        else if (Jude==2)||(Jude==-2)
            switch(b-d){
                case 1: retr=true;break;
                case -1:retr=true;break;
                default:retr=false;
            }else if retr=false;
        
    }

    int Jis(int a,int b,int c,int d){
        for(int i=a;i<c;i++)
        {
            for(int j=b;j<d;j++){

                  if(Jud(a,b,c,d))
                    a=a+1;
            }
        }
    }

    public static void main(String args[]){
        System.out.println("请输入:");
        Scanner s=new Scanner(System.in);
        int a=s.nextInt();
        int b=s.nextInt();
        System.out.println("您输入的a和b分别是:a="+a+";b="+b);//起点

        int c=s.nextInt();
        int d=s.nextInt();
        System.out.println("您输入的a和b分别是:c="+c+";d="+d);//终点

        int e=s.nextInt();
        int f=s.nextInt();
        System.out.println("您输入的陷阱点是:e="+e+";f="+f);//马所在的位置

        Main m=new Main();
        System(m.Jis(a,b,c,d,e,f));
        
    }
}


/*棋盘上 

A 点有一个过河卒,需要走到目标 B 点。卒行走的规则:可以向下、或者向右。同时在棋盘上 

C 点有一个对方的马,该马所在的点和所有跳跃一步可达的点称为对方马的控制点。因此称之为“马拦过河卒”。

棋盘用坐标表示,A 点 (0,0) B 点(n,m),同样马的位置坐标是需要给出的。
现在要求你计算出卒从A点能够到达B点的路径的条数,假设马的位置是固定不动的,并不是卒走一步马走一步。*/