记录编号 581689 评测结果 AAAAAAAAAA
题目名称 [NOIP 2002]过河卒 最终得分 100
用户昵称 Gravatar┭┮﹏┭┮ 是否通过 通过
代码语言 C++ 运行时间 0.000 s
提交时间 2023-08-09 20:55:00 内存使用 0.00 MiB
显示代码纯文本
#include <bits/stdc++.h> 
using namespace std;
const int N = 30;
int n,m,s,t;
long long f[N][N];
bool v[N][N];
void prepare(int x,int y){
	v[x][y] = 1;
	v[x+1][y+2] = v[x+2][y+1] = v[x+1][y-2] = v[x+2][y-1] = 1;
	v[x-1][y+2] = v[x-2][y+1] = v[x-1][y-2] = v[x-2][y-1] = 1;
}
int main(){
	freopen("pj024.in","r",stdin);
	freopen("pj024.out","w",stdout);
	scanf("%d%d%d%d",&n,&m,&s,&t);
	n++,m++,s++,t++;
	prepare(s,t);
	f[1][0] = 1;
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= m;j++){
			if(!v[i-1][j])f[i][j] += f[i-1][j];
			if(!v[i][j-1])f[i][j] += f[i][j-1];
		}
	}
	printf("%lld\n",f[n][m]);
	
	return 0;
	
}