60分卡好几个月了,悬关
查看原帖
60分卡好几个月了,悬关
777809
IOI_AK_TLR楼主2023/8/6 19:56

3、4点会错

#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL n,m,x,y;
LL a[30][30],px[9]={0,2,1,-1,-2,-2,-1,1,2},py[9]={0,1,2,2,1,-1,-2,-2,-1};
bool ctrl[30][30];
int main()
{
	cin>>n>>m>>x>>y;
	for(LL i=0;i<9;i++)
	{
		LL tx=x+px[i],ty=y+py[i];
		if(tx>=0&&ty>=0&&tx<=n&&ty<=m)
			ctrl[tx][ty]=true;
	}
	for(LL i=0;i<=n;i++)
		a[i][0]=!ctrl[i][0];
	for(LL i=0;i<=m;i++)
		a[0][i]=!ctrl[0][i];
	for(LL i=1;i<=n;i++)
	{
		for(LL j=1;j<=m;j++)
		{
			if(!ctrl[i][j])
				a[i][j]=a[i-1][j]+a[i][j-1];
		}
	}
	cout<<a[n][m];
	return 0;
}
2023/8/6 19:56
加载中...