HDU 6312 Game---博弈(思维)2018 Multi-University Training Contest 2

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6312

题意:一共有1到n个数,分别为1到n,两个人轮流选取一个数字,消去能被这个数整除的数字。谁没得选谁输。Alice先选。问她是否能赢。

题解:稍微思考一下就知道,谁先手谁必赢,因为1能整出所有数字。

代码:

#include<bits/stdc++.h>
using namespace std;

int main(){
	int n;
	while(~scanf("%d",&n)){
		printf("Yes\n");
	}
	return 0;
}

猜你喜欢

转载自blog.csdn.net/pk__pk/article/details/81233150