HDU 1907 John (Nim博弈)】的更多相关文章

John 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. A…
题目 参考了博客:http://blog.csdn.net/akof1314/article/details/4447709 //0 1 -2 //1 1 -1 //0 2 -1 //1 2 -1 //2 2 -2 //0 3 -1 //1 3 -1 //2 3 -1 //3 3 -2 //0 4 -1 //1 4 -1 //2 4 -1 //3 4 -1 //4 4 -2 //0 5 -1 //1 5 -1 //2 5 -1 //3 5 -1 /* 尼姆博弈.对于N堆的糖,一种情况下是每堆都是…
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…
John Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2034    Accepted Submission(s): 1096 Problem Description Little John is playing very funny game with his younger brother. There is one big bo…
John Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)http://acm.hdu.edu.cn/showproblem.php?pid=1907 Problem Description Little John is playing very funny game with his younger brother. There is one big box filled wi…
题目链接: PKU:http://poj.org/problem? id=3480 HDU:http://acm.hdu.edu.cn/showproblem.php? pid=1907 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…
思路: 注意与Nimm博弈的区别,谁拿完谁输! 先手必胜的条件: 1.  每一个小游戏都只剩一个石子了,且SG = 0. 2. 至少有一堆石子数大于1,且SG不等于0 证明:1. 你和对手都只有一种选择,随便怎么拿,你都赢了 2.  a:如果只有一堆石子数量大于1,那么你赢了,你可以拿完使得整个游戏的1的数量不变,剩余1个整个游戏1的数量增加. b:如果至少有两堆石子数大于1,那么你可以让SG变为0,令对手处于P态,并且当前至少有两堆数量大于1,对手无论怎么拿SG都会变成非0. 结论:当石子数量…
传送门 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int main() { int t; scanf("%d",&t); while(t--) { ; ,g=;//¹Âµ¥¶Ñ¡¢³äÔ£¶Ñ scanf("%d",&n); ;i<n;i++) { scanf("%d",&a…
John Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 4704    Accepted Submission(s): 2720 Problem Description Little John is playing very funny game with his younger brother. There is one big bo…
John Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 6000    Accepted Submission(s): 3486 Problem Description Little John is playing very funny game with his younger brother. There is one big bo…