HDU 2509】的更多相关文章

1.HDU 2509  2.题意:n堆苹果,两个人轮流,每次从一堆中取连续的多个,至少取一个,最后取光者败. 3.总结:Nim博弈的变形,还是不知道怎么分析,,,,看了大牛的博客. 传送门 首先给出结论:先手胜当且仅当(1)所有堆石子数都为1且游戏的SG值为0,(2)存在某堆石子数大于1且游戏的SG值不为0.证明:(1)若所有堆石子数都为1且SG值为0,则共有偶数堆石子,故先手胜.(2) i)只有一堆石子数大于1时,我们总可以对该堆石子操作,使操作后石子堆数为奇数且所有堆得石子数均为1 ii)有…
如果我们规定当局面中所有的单一游戏的SG值为0时,游戏结束,则先手必胜当且仅当:(1)游戏的SG!=0 && 存在单一游戏的SG>1:(2)游戏的SG==0  && 任意单一游戏的SG==0. /** @Date : 2017-10-15 01:49:12 * @FileName: HDU 2509 基础anti-sg.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link…
与HDU 1907一样... #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<queue> #include<stack> #include<cmath> #include<algorithm> #include<malloc.h> using namespace std; #defin…
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…
多堆的情况要处理好孤单堆 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #include<map> using namespace std; #define MOD 1000000007 const int INF=0x3f3f3f3f; ; typedef…
Be the Winner Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3326    Accepted Submission(s): 1853 Problem Description Let's consider m apples divided into n groups. Each group contains no more…
博弈论水题!!! 代码如下: #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"<<…
题目链接 有n堆苹果, 对于其中的每一堆的x个苹果, 它是放在一条线上的. 你每次可以对一堆苹果进行操作, 可以取y个, 1<=y<=x. 然后如果你是取的一条线上中间的苹果, 那么这一堆苹果将会变成两堆. 问你先手是否必胜. 简单的打一个sg表就可以了. 注意特判全都是1的情况. #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include…
题目大意:输入一个整数n,表示火柴堆数(原题其实指的是苹果堆数,但是为了尽量与模板保持一致,所以在这里理解为火柴堆数....其实理解为什么都没关系, 重要的是,理解就行....).在接下来的一行中,有n个数字,表示每个火柴堆的火柴根数. 解题思路:还是去火柴棒的问题 详细的说明请参考上一篇博客 代码如下: /* * 2509_1.cpp * * Created on: 2013年9月1日 * Author: Administrator */ #include <iostream> using…
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…