【HDU】1846 Brave Game

http://acm.hdu.edu.cn/showproblem.php?pid=1846

题意:二人博弈,1堆石子每次取1~m个,没有石子可取的输,输出先手胜利还是后手胜利。

#include <cstdio>
using namespace std;
int main() {
	int c; scanf("%d", &c);
	while(c--) {
		int n, m; scanf("%d%d", &n, &m); printf("%s
", n%(m+1)?"first":"second");
	}
	return 0;
}

  


这种题其实我是不想开博文的= =为了以后来一个博弈论题集233

sg值裸题...还是一堆的...sg和都没用到= =..反正转移到km+1的人都是必败的,于是mod (m+1)来判断即可= =

原文地址:https://www.cnblogs.com/iwtwiioi/p/4278046.html