当前位置:网站首页>博弈论 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");
}
}
原创不易
转载请标明出处
如果对你有所帮助 别忘啦点赞支持哈
边栏推荐
- SQLMAP使用教程(二)实战技巧一
- Leetcode-31: next spread
- 打印机脱机时一种容易被忽略的原因
- leetcode-6108:解密消息
- Leetcode array operation
- 【Rust 笔记】16-输入与输出(上)
- Leetcode backtracking method
- [rust notes] 16 input and output (Part 2)
- 对for(var i = 0;i < 5;i++) {setTimeout(() => console.log(i),1000)}的深入分析
- NotImplementedError: Cannot convert a symbolic Tensor (yolo_boxes_0/meshgrid/Size_1:0) to a numpy ar
猜你喜欢

Liunx starts redis
![Introduction to LVS [unfinished (semi-finished products)]](/img/72/d5a943a8d6d71823dcbd7f23dda35b.png)
Introduction to LVS [unfinished (semi-finished products)]

MySQL advanced part 2: storage engine

4. 对象映射 - Mapping.Mapster

leetcode-6110:网格图中递增路径的数目

redis发布订阅命令行实现

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

1.13 - RISC/CISC

Chapter 6 relational database theory

MySQL advanced part 2: the use of indexes
随机推荐
Liunx starts redis
leetcode-6109:知道秘密的人数
【LeetCode】Day95-有效的数独&矩阵置零
Traditional databases are gradually "difficult to adapt", and cloud native databases stand out
SPI details
Record the process of configuring nccl and horovod in these two days (original)
Data visualization chart summary (II)
leetcode-6110:网格图中递增路径的数目
可变电阻器概述——结构、工作和不同应用
Navicat連接Oracle數據庫報錯ORA-28547或ORA-03135
MySQL advanced part 1: stored procedures and functions
MySQL advanced part 2: storage engine
Overview of variable resistors - structure, operation and different applications
JS quickly converts JSON data into URL parameters
927. 三等分 模拟
Multi screen computer screenshots will cut off multiple screens, not only the current screen
【LeetCode】Easy | 20. Valid parentheses
1.14 - assembly line
leetcode-556:下一个更大元素 III
Règlement sur la sécurité des réseaux dans les écoles professionnelles secondaires du concours de compétences des écoles professionnelles de la province de Guizhou en 2022