备战NOIP——模板复习18

这里只有模板,并不作讲解,仅为路过的各位做一个参考以及用做自己复习的资料,转载注明出处。

Nim游戏

/*Copyright: Copyright (c) 2018
*Created on 2018-11-05 
*Author: 十甫
*Version 1.0 
*Title: nim游戏
*Time: 约2 mins
*/
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

int main() {
	int t;
	scanf("%d", &t);
	while(t--) {
		int n;
		scanf("%d", &n);
		int ans = 0;
		for(int i = 1;i <= n;i++) {
			int k;
			scanf("%d", &k);
			ans ^= k;
		}
		ans ^= 0;
		if(ans) printf("Yes
");
		else printf("No
");
	}
	return 0;
}
NOIP 2018 RP++
原文地址:https://www.cnblogs.com/Black-S/p/9930705.html