救救孩子吧 只能对2 5两个题 别的过不去 求大佬
查看原帖
救救孩子吧 只能对2 5两个题 别的过不去 求大佬
438108
a2533577482楼主2020/11/22 11:51
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int xB=scanner.nextInt();
		int yB=scanner.nextInt();
		int xM=scanner.nextInt();
		int yM=scanner.nextInt();
		int[][] t=new int[20][20];
		for(int j=0;j<t[0].length;j++){
			t[0][j]=1;
		}
		for(int i=0;i<t.length;i++){
			t[i][0]=1;
		}
		if(xM >0&& yM>0){
			t[xM][yM]=10000;
		}
		
		if(xM-1 >0&& yM-2>0){
			t[xM-1][yM-2]=10000;
		}
		if(xM-1 >0&& yM+2>0){
			t[xM-1][yM+2]=10000;
		}
		if(xM-2 >0&& yM-1>0){
			t[xM-2][yM-1]=10000;
		}
		if(xM-2 >0&& yM+1>0){
			t[xM-2][yM+1]=10000;
		}
		if(xM+1 >0&& yM-2>0){
			t[xM+1][yM-2]=10000;
		}
		if(xM+1 >0&& yM+2>0){
			t[xM+1][yM+2]=10000;
		}
		if(xM+2 >0&& yM-1>0){
			t[xM+2][yM-1]=10000;
		}
		if(xM+2 >0&& yM+1>0){
			t[xM+2][yM+1]=10000;
		}
		for(int i=1;i<=xB;i++){
			for(int j=1;j<=yB;j++){
				if(t[i][j]!=10000){
					t[i][j]=t[i-1][j]+t[i][j-1];
				}else{
					t[i][j]=0;
				}
			}
		}
		System.out.println(t[xB][yB]);
	}
}
2020/11/22 11:51
加载中...