当前位置:网站首页>博弈论 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");
}
}
原创不易
转载请标明出处
如果对你有所帮助 别忘啦点赞支持哈
边栏推荐
- 【Rust 笔记】15-字符串与文本(下)
- 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
- Currently clicked button and current mouse coordinates in QT judgment interface
- MySQL advanced part 1: index
- 快速使用Amazon MemoryDB并构建你专属的Redis内存数据库
- Open source storage is so popular, why do we insist on self-development?
- __ builtin_ Popcount() counts the number of 1s, which are commonly used in bit operations
- 剑指 Offer II 058:日程表
- Flutter Web 硬件键盘监听
- TypeScript 基础讲解
猜你喜欢
Leetcode-6111: spiral matrix IV
SQLMAP使用教程(一)
LeetCode-54
Chapter 6 relational database theory
MIT-6874-Deep Learning in the Life Sciences Week 7
SPI 详解
MIT-6874-Deep Learning in the Life Sciences Week 7
MySQL advanced part 2: MySQL architecture
Traditional databases are gradually "difficult to adapt", and cloud native databases stand out
Appium foundation - use the first demo of appium
随机推荐
Leetcode-6108: decrypt messages
11-gorm-v2-02-create data
__ builtin_ Popcount() counts the number of 1s, which are commonly used in bit operations
Sum of three terms (construction)
Binary search template
TypeScript 基础讲解
SQLMAP使用教程(一)
LVS简介【暂未完成(半成品)】
Golang uses context gracefully
1040 Longest Symmetric String
Daily question 1189 Maximum number of "balloons"
【Rust 笔记】14-集合(上)
Daily question 1984 Minimum difference in student scores
4. Object mapping Mapster
In depth analysis of for (VaR I = 0; I < 5; i++) {settimeout (() => console.log (I), 1000)}
leetcode-556:下一个更大元素 III
How to understand the definition of sequence limit?
[BMZCTF-pwn] ectf-2014 seddit
leetcode-1200:最小绝对差
Simple selection sort of selection sort