HDU2176尼姆博弈】的更多相关文章

HDU2176 http://acm.hdu.edu.cn/showproblem.php?pid=2176 假设有3个数,a[0],a[1],a[2];那么ans=a[0]^a[1]^a[2];若ans^a[0]=s; 那么a[1]^a[2]^s=a[1]^a[2]^ans^a[0]=a[1]^a[2]^a[0]^a[1]^a[2]^a[0]=0(根据异或的性质). 上代码: #include<stdio.h> #include<iostream> #include<str…
如果 a1^a2^a3........^an=0,必败态. 如果 a1^a2^a3........^an!=0,必胜态. 对于必胜态,若a1^a2^a3........^an=k,要让对方为必败态,所以一定存在数,他的2进制有k的最高位上的1,使对方为必败态: 所以如果k^a[i]<a[i],一定是从该数中取,a[i]-k^a[i]个. 如果剩下一堆物品:必胜: 如果剩下二堆,都为1,必输: 如果剩下二堆,一堆为1,另一堆为n,必胜: #include<stdio.h> #include…
Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2145    Accepted Submission(s): 1622 Problem Description 大学时光是浪漫的,女生是浪漫的,圣诞更是浪漫的,但是Rabbit和Grass这两个大学女生在今年的圣诞节却表现得一点都不浪漫:不去逛商场,不去逛…
Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3864    Accepted Submission(s): 2919 Problem Description 大学时光是浪漫的,女生是浪漫的,圣诞更是浪漫的,但是Rabbit和Grass这两个大学女生在今年的圣诞节却表现得一点都不浪漫:不去逛商场,不去逛…
Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description   Input   Output   Sample Input   Sample Output   Hint   Description 大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了! 做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱…
Climbing the Hill Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u Submit Status Description Alice and Bob are playing a game called "Climbing the Hill". The game board consists of cells arranged vertically, as the…
C - Crazy Calendar Time Limit:4000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1393 Description 2011 was a crazy year. Many people all over the world proposed on 11-11-11, married on 11-11-11, some even w…
A - Matrix Game Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Description Given an m x n matrix, where m denotes the number of rows and n denotes the number of columns and in each cell a pile of stones is gi…
LightOJ1253 :Misere Nim 时间限制:1000MS    内存限制:32768KByte   64位IO格式:%lld & %llu 描述 Alice and Bob are playing game of Misère Nim. Misère Nim is a game playing on k piles of stones, each pile containing one or more stones. The players alternate turns and…
Fibonacci again and again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5088    Accepted Submission(s): 2126 Problem Description 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;…