HDU-2509-Be the Winner,博弈题~~水过~~】的更多相关文章

Be the Winner Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) http://acm.hdu.edu.cn/showproblem.php?pid=2509 Problem Description Let's consider m apples divided into n groups. Each group contains no more than 100 a…
题目链接 有n堆苹果, 对于其中的每一堆的x个苹果, 它是放在一条线上的. 你每次可以对一堆苹果进行操作, 可以取y个, 1<=y<=x. 然后如果你是取的一条线上中间的苹果, 那么这一堆苹果将会变成两堆. 问你先手是否必胜. 简单的打一个sg表就可以了. 注意特判全都是1的情况. #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include…
Problem Description Little John is playing very funny game with his younger brother. There is one big box filled with M&Ms of different colors. At first John has to eat several M&Ms of the same color. Then his opponent has to make a turn. And so o…
Be the Winner Problem Description   Let's consider m apples divided into n groups. Each group contains no more than 100 apples, arranged in a line. You can take any number of consecutive apples at one time.For example "@@@" can be turned into &q…
题目大意:输入一个整数n,表示火柴堆数(原题其实指的是苹果堆数,但是为了尽量与模板保持一致,所以在这里理解为火柴堆数....其实理解为什么都没关系, 重要的是,理解就行....).在接下来的一行中,有n个数字,表示每个火柴堆的火柴根数. 解题思路:还是去火柴棒的问题 详细的说明请参考上一篇博客 代码如下: /* * 2509_1.cpp * * Created on: 2013年9月1日 * Author: Administrator */ #include <iostream> using…
传送门 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int main() { int n; while(~scanf("%d",&n)) { ; ,g=; ;i<n;i++) { scanf("%d",&a); ) c++; ) g++; res^=a; } if(!res) { )//T2 printf…
博弈论水题!!! 代码如下: #include<stdio.h> #include<iostream> using namespace std; int main(){ int i,t,n,k,m; while(cin>>n){ m=;t=; ;i<n;i++){ cin>>k; ) t++; m^=k; } &&t>=)||(m!=&&t==)) cout<<"No"<<…
Be the Winner Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3591    Accepted Submission(s): 2009 Problem Description Let's consider m apples divided into n groups. Each group contains no more…
1.HDU 2509  2.题意:n堆苹果,两个人轮流,每次从一堆中取连续的多个,至少取一个,最后取光者败. 3.总结:Nim博弈的变形,还是不知道怎么分析,,,,看了大牛的博客. 传送门 首先给出结论:先手胜当且仅当(1)所有堆石子数都为1且游戏的SG值为0,(2)存在某堆石子数大于1且游戏的SG值不为0.证明:(1)若所有堆石子数都为1且SG值为0,则共有偶数堆石子,故先手胜.(2) i)只有一堆石子数大于1时,我们总可以对该堆石子操作,使操作后石子堆数为奇数且所有堆得石子数均为1 ii)有…
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-size: 10.5000pt } h1 { margin-top: 5.0000pt; margin-bottom: 5.0000pt; text-align: center; font-family: 宋体; color: rgb(26,92,200); font-weight: bold; fo…