POJ 2234 Matches Game (经典Nim博弈)
来源:互联网 发布:java jvm1.5官方下载 编辑:程序博客网 时间:2024/05/22 16:00
题目连接
题意:
给你M堆物品,让两个人进行轮流选择,每一个人可以选择任意一堆的任意个物品,假设每个人都很聪明,求解这种情况下是前者必赢还是后者必赢,
直接Nim博弈,判断sum = A[0] ^ A[1] ^ A[2] ...即可
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int MAXN = 20 + 5;const int MAXM = 1e3 + 5;int A[MAXN], n;int main(){ while(~scanf("%d", &n)){ int sum = 0; for(int i = 0;i < n;i ++){ scanf("%d", &A[i]); sum ^= A[i]; } if(sum){ printf("Yes\n"); } else{ printf("No\n"); } } return 0;}
1 0
- POJ 2234 Matches Game (经典Nim博弈)
- POJ Matches Game 2234【经典博弈Nim游戏】
- POJ 2234 Matches Game (nim博弈裸题)
- poj 2234 Matches Game (博弈)
- [博弈]POJ 2234 Matches Game
- POJ 2234 Matches Game(博弈)
- POJ 2234 Matches Game(直接的NIM)
- POJ 2234 Matches Game 尼姆博弈
- POJ 2234-Matches Game(博弈)
- POJ 2234 Matches Game 尼姆博弈
- poj--2234--Matches Game(尼姆博弈)
- POJ--2234 Matches Game(尼姆博弈)
- 2234-Matches Game-博弈
- POJ 2234 Matches Game NIM曲石子游戏
- POJ 2234 Matches Game(尼姆博弈)
- poj 2234Matches Game尼姆博弈模版题
- POJ-2234 Matches Game(尼姆博弈)
- POJ-2234-Matches Game(尼姆博弈)
- c++内存池作用和优势
- polymer 自定义元素学习
- 80386 处理器的寻址方式
- 深度学习主流框架Caffe
- jQuery插件开发模式
- POJ 2234 Matches Game (经典Nim博弈)
- PAT-A 1042. Shuffling Machine
- IO流初学flush和close的区别
- ruby中的等于判断
- 相对定位的特点
- javascript 面向对象封装与继承
- 明星软件工程师的10种特质
- Android View控件的事件派发
- polymer 自定义元素学习教程