当前位置:网站首页>博弈论 AcWing 891. Nim游戏
博弈论 AcWing 891. Nim游戏
2022-07-05 06:16:00 【T_Y_F666】
博弈论 AcWing 891. Nim游戏
原题链接
算法标签
数学知识 博弈论 Nim游戏
思路
博弈论基本概念

结论证明

代码
#include<bits/stdc++.h>
#define int long long
#define abs fabs
#define rep(i, a, b) for(int i=a;i<b;++i)
#define Rep(i, a, b) for(int i=a;i>=b;--i)
using namespace std;
const int N = 5015;
int pr[N], st[N], s[N], cnt;
inline int read(){
int s=0,w=1;
char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;
}
void put(int x) {
if(x<0) putchar('-'),x=-x;
if(x>=10) put(x/10);
putchar(x%10^48);
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n=read();
int ans=0;
while(n--){
int a=read();
ans^=a;
}
if(ans){
puts("Yes");
}else{
puts("No");
}
}
原创不易
转载请标明出处
如果对你有所帮助 别忘啦点赞支持哈
边栏推荐
- Niu Mei's math problems
- leetcode-6109:知道秘密的人数
- LeetCode-54
- Leetcode heap correlation
- Traditional databases are gradually "difficult to adapt", and cloud native databases stand out
- Leetcode-9: palindromes
- 1040 Longest Symmetric String
- SPI details
- MatrixDB v4.5.0 重磅发布,全新推出 MARS2 存储引擎!
- WordPress switches the page, and the domain name changes back to the IP address
猜你喜欢

Is it impossible for lamda to wake up?

阿里巴巴成立企业数智服务公司“瓴羊”,聚焦企业数字化增长

MySQL advanced part 1: stored procedures and functions

实时时钟 (RTC)

MySQL怎么运行的系列(八)14张图说明白MySQL事务原子性和undo日志原理

leetcode-6111:螺旋矩阵 IV

LeetCode-61

SQLMAP使用教程(一)

Groupbykey() and reducebykey() and combinebykey() in spark

Simple selection sort of selection sort
随机推荐
LeetCode 1200. Minimum absolute difference
MySQL advanced part 2: optimizing SQL steps
快速使用Amazon MemoryDB并构建你专属的Redis内存数据库
wordpress切换页面,域名变回了IP地址
Sqlmap tutorial (1)
SQLMAP使用教程(一)
Sqlmap tutorial (II) practical skills I
Sum of three terms (construction)
TypeScript 基础讲解
多屏电脑截屏会把多屏连着截下来,而不是只截当前屏
Leetcode-556: the next larger element III
LeetCode 0107.二叉树的层序遍历II - 另一种方法
LeetCode-54
数据可视化图表总结(二)
js快速将json数据转换为url参数
SPI details
MIT-6874-Deep Learning in the Life Sciences Week 7
Collection: programming related websites and books
LeetCode 0108. Convert an ordered array into a binary search tree - the median of the array is the root, and the left and right of the median are the left and right subtrees respectively
Multi screen computer screenshots will cut off multiple screens, not only the current screen