Ming encounter the HDU - 2897 (sg function play table, Bash Game)

1. Obviously, a title given range, find a bunch of results, so be sure to do with Bash Game, that is, with n% period (l + r) related to
2. But there is a very different place, where the final people take or lose, if want to be a big hurdle want to direct, but also thought wrong, so make a table with the function sg look at the relationship between the results and the remainder

int n, r, l;
/*int fg[1010];
int sg(int x)
{
	if (fg[x] != -1)return fg[x];
	unordered_set<int> st;
	f(i, l, r)
		if (x - i > 0)st.insert(sg(x - i));
	for (int i = 0;;++i)
		if (!st.count(i))return fg[x] = i;
}*/
int main()
{
	
	while (~scanf("%d%d%d",&n,&l,&r))
	{
		int re = n % (l + r);
		if (re >= 1 && re <= l)puts("LOST");
		else puts("WIN");
	}
	return 0;
}
Published 21 original articles · won praise 2 · Views 330

Guess you like

Origin blog.csdn.net/qq_43543086/article/details/104738501