当前位置:网站首页>Game theory acwing 892 Steps Nim game
Game theory acwing 892 Steps Nim game
2022-07-05 06:24:00 【T_ Y_ F666】
Game theory AcWing 892. steps -Nim game
Original link
Algorithm tags
Math knowledge Game theory Nim game
Ideas
Code
#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 = 100005;
int a[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;
rep(i, 0, n){
a[i]=read();
if(!(i%2)){
ans^=a[i];
}
}
if(ans){
puts("Yes");
}else{
puts("No");
}
}
Originality is not easy.
Reprint please indicate the source
If it helps you Don't forget to praise and support
边栏推荐
- Leetcode-9: palindromes
- Leetcode backtracking method
- Presentation of attribute value of an item
- [leetcode] day95 effective Sudoku & matrix zeroing
- Redis publish subscribe command line implementation
- How to understand the definition of sequence limit?
- 博弈论 AcWing 894. 拆分-Nim游戏
- Daily question 1189 Maximum number of "balloons"
- 1.15 - input and output system
- Doing SQL performance optimization is really eye-catching
猜你喜欢
LeetCode 0107. Sequence traversal of binary tree II - another method
4. 对象映射 - Mapping.Mapster
How to make water ripple effect? This wave of water ripple effect pulls full of retro feeling
ollvm编译出现的问题纪录
Matrixdb V4.5.0 was launched with a new mars2 storage engine!
Quickly use Amazon memorydb and build your own redis memory database
Redis-01.初识Redis
[2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis
Redis publish subscribe command line implementation
[2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian
随机推荐
[wustctf2020] plain_ WP
Filter the numbers and pick out even numbers from several numbers
Record the process of configuring nccl and horovod in these two days (original)
Leetcode dynamic programming
Leetcode backtracking method
1.14 - assembly line
高斯消元 AcWing 884. 高斯消元解异或线性方程组
JS quickly converts JSON data into URL parameters
11-gorm-v2-02-create data
背包问题 AcWing 9. 分组背包问题
Leetcode divide and conquer / dichotomy
Day 2 document
在新线程中使用Handler
MySQL advanced part 1: stored procedures and functions
4. 对象映射 - Mapping.Mapster
Traversal of leetcode tree
our solution
MySQL advanced part 2: SQL optimization
C - XOR to all (binary topic)
Leetcode-556: the next larger element III