HDU 1907】的更多相关文章

1.HDU 1907 2.题意:n堆糖,两人轮流,每次从任意一堆中至少取一个,最后取光者输. 3.总结:有点变形的Nim,还是不太明白,盗用一下学长的分析吧 传送门 分析:经典的Nim博弈的一点变形.设糖果数为1的叫孤独堆,糖果数大于1的叫充裕堆,设状态S0:a1^a2^..an!=0&&充裕堆=0,则先手必败(奇数个为1的堆,先手必败).S1:充裕堆=1,则先手必胜(若剩下的n-1个孤独堆个数为奇数个,那么将那个充裕堆全部拿掉,否则将那个充裕堆拿得只剩一个,这样的话先手必胜).T0:a1…
题目链接: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 with M&Ms of different colors. At first John has to eat several M&Ms of the same c…
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…
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…
参见上一篇博客,里面有分析和结论. #include <cstdio> int main() { int T; scanf("%d", &T); while(T--) { , xorsum = ;//c为充裕堆的个数 scanf("%d", &n); ) c++; } ) || (xorsum && !c)) puts("Brother");//T2和S0状态必败 else puts("Joh…
很简单的博弈论问题!!(注意全是1时是特殊情况) 代码如下: #include<stdio.h> #include<iostream> using namespace std; int main(){ int i,t,n,k,m; bool flag; scanf("%d",&t); while(t--){ scanf("%d",&n); flag=;m=; ;i<n;i++){ cin>>k; m^=k;…
博弈入门题吧. 把尼姆博弈推广到n堆,都是用异或运算.还有个总结的地方是,只要先手面对的是奇异局势,则胜负都掌握在后手.本题,题目要求是最后拿完的输,尼姆博弈是最后拿完的赢.但实际上优先权都掌握在后手,前提是先手面对的是奇异局势. 本题还要注意一下每堆都是1的情况. 最后还是膜拜一下OI大神,推荐一个博客 #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #incl…
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…
传送门 #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…