题解
2025-03-28 21:47:09
发布于:江苏
2阅读
0回复
0点赞
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
bool f[25][25];
long long dp[25][25],n,m,x,y;
int main(){
cin>>n>>m>>x>>y;
n+=2;
m+=2;
x+=2;
y+=2;
f[x][y]=1;
f[x-2][y-1]=1;
f[x-2][y+1]=1;
f[x-1][y-2]=1;
f[x-1][y+2]=1;
f[x+2][y-1]=1;
f[x+2][y+1]=1;
f[x+1][y-2]=1;
f[x+1][y+2]=1;
dp[2][2]=1;
for(int i=2;i<=n;i++)
{
for(int j=2;j<=m;j++)
{
if(i==2 && j==2)
{
continue;
}
if(f[i][j]==1)
{
continue;
}
dp[i][j]=dp[i-1][j]+dp[i][j-1];
}
}
cout<<dp[n][m];
}
这里空空如也
有帮助,赞一个