摘要:Lucifer's Pyramid of Numbers时间限制:1000ms 内存限制:65535kB描述Lucifer has a strange hobby, he sometimes put offending evils to the Pyramid of Numbers (PoN), and then decides whether he will liberate the evils or not through a game.In PoN, the poor evil could only move straightly down or bottom-right ste
阅读全文
摘要:Ferguson博弈(清空/分割游戏)清空/分割游戏也叫做Ferguson博弈。进行游戏需要用到两个盒子。在游戏的开始,第一个盒子中有n枚石子,第二个盒子中有m个石子(n, m > 0)。参与游戏的两名玩家轮流执行这样的操作:清空一个盒子中的石子,然后从另一个盒子中拿若干石子到被清空的盒子中,使得最后两个盒子都不空,才轮到对方取。当两个盒子中都只有一枚石子时,游戏结束。最后成功执行操作的玩家获胜。对于一个位置(x, y)来说,如果x, y中有一个偶数,那么(x, y)是N(必胜)位置。如果x和y都是奇数,那么(x, y)是P位置(必败)。可以用数学归纳法证明。证明结论:(x,y)至少一偶
阅读全文
摘要:summerDescriptionThissummerissohotthatYSYisovercamebytheheatandatthistimenothingcouldbebetterthancoolwater.ShoweringwiththecoolwatermakesYSYsohappy.Buthefeelslonelyandinviteshisfriendtoenjoyit.That'sareallygoodgamewiththefollowingrules:First:Wehavetwobigbucketswhichissobigthatyoucannotfillupit.T
阅读全文
摘要:Euclid's GameDescriptionTwo players, Stan and Ollie, play, starting with two natural numbers. Stan, the first player, subtracts any positive multiple of the lesser of the two numbers from the greater of the two numbers, provided that the resulting number must be nonnegative. Then Ollie, the seco
阅读全文
摘要:巴什博弈所谓巴什博弈,是ACM题中最简单的组合游戏,大致上是这样的:只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取1个,最多取m个,最后取光者得胜。分析: 显然,如果n = m + 1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个,后取者都能够一次拿走剩余的物品,后者取胜。因此我们发现了如何取胜的法则:如果 n = (m + 1) * r + s ,(r为任意自然数,s≤m),即n%(m+1) != 0,则先取者肯定获胜。 每一局,你都必须构建一个局势,这个局势就是每次都留给对手m+1的倍数个物品。因为,如果n=(m+1)r + s,(r为任意自然数,s≤m),那么先取
阅读全文
摘要:取石子游戏Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 29247Accepted: 9575Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。Input输入包含若干行,表示若干种石子的初始情况,其中每一行包含两个非负整数a和b,表示两堆石子的数目,a和b都不大于
阅读全文
摘要:链表排序//首先写一下两种插入法void CreateListF(LinkList *&L,ElemType a[],int n){LinkList *s;int i;L=(LinkList *)malloc(sizeof(LinkList));L->next=NULL;for(i=0;i<n;i++){s=(LinkList *)malloc(sizeof(LinkList));s->data=a[i];s->next=L->next;L->next=s;}}尾插法void CreateListF(LinkList *&L,ElemType
阅读全文
摘要:指针一、概念1、“指针”是指地址,是常量,“指针变量”是指取值为地址的变量 变量的指针就是变量的地址。存放变量地址的变量是指针变量。二、理解1、i_pointer代表指针变量,而*i_pointer是i_pointer所指向的变量i=3;i_pointer=&i;2、调用函数swap(int *p1,int *p2){int temp;temp=*p1;*p1=*p2;*p2=temp;}main(){int a,b;int *pointer_1,*pointer_2;scanf("%d,%d",&a,&b);pointer_1=&a;poi
阅读全文