第一篇题解的trans函数太复杂了,有谁来解释一下?
查看原帖
第一篇题解的trans函数太复杂了,有谁来解释一下?
249676
Wang_xun_楼主2022/8/22 10:31
bool trans(int x,int y,int a,int b,int &c,int &d)
{
	c=x,d=y;
	if (b)
	{
		if (x>2) return 0;
		if (x<b) return 0;
	}
	if (1<=a&&a<=2) d=max(d-a,0);
	if (!((1<=a&&a<=2)||(1<=x&&x<=2)))
	{
		int tot=max(a-2,0)+max(x-2,0);
		d=max(d,2-tot);
	}
	if (1<=a&&a<=2&&!(1<=c&&c<=2)) c=min(a+max(c-2,0)+2,4);
	return 1;
}
2022/8/22 10:31
加载中...