求助大佬,40分 QAQ
查看原帖
求助大佬,40分 QAQ
170274
yydxmy楼主2021/10/22 15:00

我知道明天就是cspj第二轮了,应该没有大佬还在逛gai了吧[哭]。求帮助QAQ

萌新写的40分代码

#include<bits/stdc++.h>
using namespace std;
int point[22][22];
int n,m,horse_x,horse_y;
int main(){	
	cin>>n>>m>>horse_x>>horse_y;
	point[horse_x][horse_y]=-1;
	if(horse_x>0&&horse_y>1){
		point[horse_x-1][horse_y-2]=-1;
		point[horse_x-1][horse_y+2]=-1;
		point[horse_x+1][horse_y-2]=-1;
		point[horse_x+1][horse_y+2]=-1;
	}
	if(horse_x>0&&horse_y>1){
		point[horse_x-2][horse_y-1]=-1;
		point[horse_x-2][horse_y+1]=-1;
		point[horse_x+2][horse_y-1]=-1;
		point[horse_x+2][horse_y+1]=-1;
	}
	if(point[0][0]==-1||point[n][m]==-1){
		cout<<0<<endl;
		return 0;
	}
	for(int x=0;x<=n;x++){
		for(int y=0;y<=m;y++){
			if(point[x][y]==-1||(x==0&&y==0)){
				point[x][y]++;
				continue;
			}
			if(x>0)
				point[x][y]+=point[x-1][y];
			if(y>0)
				point[x][y]+=point[x][y-1];
		}
	}
	cout<<point[n][m]<<endl;
	return 0;
}
2021/10/22 15:00
加载中...