一篇蒟蒻的题解

wangruichen 2022-05-02 21:40:51 14 返回题目

#include<ios>
#define int unsigned long long
bool vis[25][25];
long long step[25][25];
inline char getc(){//超级读入优化
	static char buf[2000001],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,2000001,stdin),p1==p2)?EOF:*p1++;
}
inline int read(){
	register char c(getc());
	register int x(0);
	while(!isdigit(c))c=getc();
	for(;isdigit(c);c=getc())x=(x<<3)+(x<<1)+(c^48);
	return x;
}
main(){
	step[1][1]=1;
	int n=read()+1,m=read()+1,x=read()+1,y=read()+1;
	vis[x][y]=1;
	vis[x-2][y-1]=
	vis[x-2][y+1]=
	vis[x+2][y-1]=
	vis[x+2][y+1]=
	vis[x-1][y+2]=
	vis[x-1][y-2]=
	vis[x+1][y+2]=
	vis[x+1][y-2]=1;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
			if((i!=1||j!=1)&&!vis[i][j])
				step[i][j]=step[i-1][j]+step[i][j-1];
	printf("%llu",step[n][m]);
}
{{ vote && vote.total.up }}